Vous êtes sur la page 1sur 78

Fixed Format LD editor

Fixed Format LD editor


The Fixed Format LD editor − general information.......................................................................1
'Property' window for variables, contacts and coils..............................................................2
Changing the column width in LD worksheets.....................................................................4
Customizing the representation of the LD worksheet...........................................................4
Exporting an FF LD code body using source conversion.....................................................5
Mouse and keyboard operations in the Fixed Format LD editor..........................................6
Opening and converting non−Fixed Format LD code bodies...............................................6
Rules concerning columns and rows of an LD worksheet....................................................7
Saving an LD code body as template (Copy to... / Insert from...).........................................7
Setting default names for newly created contacts/coils and variables in the current
worksheet............................................................................................................................8
Setting editor defaults in the 'Options' dialog.......................................................................9
Setting the display mode for variables...............................................................................10

General editing operations in the Fixed Format LD editor.........................................................13


Copying objects in LD worksheets.....................................................................................13
Cutting objects in LD worksheets.......................................................................................14
Deleting objects in LD worksheets.....................................................................................14
Marking objects in LD worksheets......................................................................................15
Moving objects in LD worksheets by drag and drop...........................................................16
Moving objects by inserting/deleting rows or columns.......................................................17
Pasting objects in LD worksheets......................................................................................18
Printing LD worksheets......................................................................................................19
Using Undo and Redo in LD worksheets...........................................................................19

Editing LD networks using the Fixed Format LD editor..............................................................21


Changing the properties of existing contacts or coils.........................................................21
Connecting objects in LD worksheets................................................................................23
How to connect objects by drag and drop............................................................23
How to connect objects using the connection mode............................................24
Editing program control statements....................................................................................25
Basic program control statements.......................................................................26
Extended program control statements.................................................................27
Inserting and editing program control statements................................................29
Replacing functions and function blocks............................................................................30
Finding and replacing LD objects.......................................................................................31
Dialog 'Find/Replace LD Objects' (local)..............................................................31
Dialog 'Global Find/Replace LD Objects'.............................................................32
Finding LD objects in all worksheets....................................................................33
Finding LD objects in the active worksheet..........................................................33
Replacing LD objects in all worksheets...............................................................34
Replacing LD objects in the active worksheet.....................................................35
Inserting comments while editing in LD..............................................................................36
Inserting connectors while editing in LD.............................................................................36
Inserting functions and function blocks in LD worksheets..................................................37
Inserting jumps and labels while editing in LD...................................................................39
Inserting left power rails (network blocks)..........................................................................40
Inserting parallel LD branches using the branch edit mode...............................................41
Inserting parallel contacts/coils..........................................................................................43
Inserting returns while editing in LD...................................................................................44
Inserting right power rails...................................................................................................44
Inserting serial contacts/coils.............................................................................................45
Inserting variables while editing in LD................................................................................46

i
Fixed Format LD editor
Editing LD networks using the Fixed Format LD editor
Declaring and inserting new variables in LD........................................................46
Inserting already declared variables in LD...........................................................48
Network blocks (left power rails)........................................................................................49

Error messages of the FF LD compiler.........................................................................................51


Error: Basic Program Control Statements are not supported!............................................51
Error: Cannot resolve generic data type! Please insert a variable!....................................51
Error: Case list empty!........................................................................................................51
Error: Caselist expected!....................................................................................................52
Error: Case list without CASE!...........................................................................................52
Error: Connection between different networks!..................................................................52
Error: Data type for object '...'! Expected data type '...'!......................................................53
Error: Data type of accu: '...'! Data type of object: '...'!........................................................53
Error: DO expected!...........................................................................................................53
Error: DO without extended WHILE!..................................................................................54
Error: ELSE without IF or CASE!........................................................................................54
Error: ELSEIF without IF!...................................................................................................54
Error: ELSEIF without IF!...................................................................................................55
Error: END_CASE expected!.............................................................................................55
Error: END_CASE missing!................................................................................................55
Error: END_CASE without CASE!......................................................................................55
Error: END_FOR expected!................................................................................................56
Error: END_FOR missing!..................................................................................................56
Error: END_FOR without FOR!..........................................................................................56
Error: END_IF expected!....................................................................................................57
Error: END_IF missing!......................................................................................................57
Error: END_IF without IF!...................................................................................................57
Error: END_REPEAT expected!.........................................................................................58
Error: END_REPEAT missing!...........................................................................................58
Error: END_REPEAT without REPEAT!.............................................................................58
Error: END_WHILE expected!............................................................................................58
Error: END_WHILE missing!..............................................................................................59
Error: END_WHILE without WHILE!...................................................................................59
Error: Exit without iteration statement!...............................................................................59
Error: Extended Program Control Statements not supported!............................................60
Error: FB instance '...' not declared!...................................................................................60
Error: Final value and step value of FOR loop expected!...................................................60
Error: Final value and step value without extended FOR!..................................................60
Error: Function formal parameter not connected!...............................................................61
Error: Illegal case list!.........................................................................................................61
Error: Illegal network!.........................................................................................................62
Error: Illegal object at right power rail!................................................................................62
Error: Illegal subscript to array: '...'!....................................................................................62
Error: Illegal usage of data type '...'!...................................................................................63
Error: Incomplete assignment!...........................................................................................63
Error: Label placed inside network!....................................................................................64
Error: Missing name!..........................................................................................................64
Error: Missing Data!............................................................................................................65
Error: Missing expression!..................................................................................................65
Error: Mixed Program Control Statements between normal style and extended style!......66
Error: Nesting level too deep!.............................................................................................66
Error: Networks are overlapping!........................................................................................66

ii
Fixed Format LD editor
Error messages of the FF LD compiler
Error: Object illegal connected!..........................................................................................66
Error: Operand expected in expression!.............................................................................67
Error: Operator expected in expression!............................................................................67
Error: Parentheses error!....................................................................................................67
Error: Program Control Statement may only be connected to left or right powerrail!.........67
Error: Program Control Statement may only be connected to left or right powerrail!.........68
Error: Program Control Statements not supported!............................................................68
Error: Sequence of Program Control Statements splitted into several Network Blocks!....68
Error: SFC not supported!..................................................................................................69
Error: Short or illegal wired or!............................................................................................69
Error: Syntax Error!............................................................................................................69
Error: THEN expected!.......................................................................................................69
Error: THEN without extended IF!......................................................................................70
Error: Too many arguments for function '...'!......................................................................70
Error: Too many explicit feedbacks or wired or per network!.............................................70
Error: Too many objects in worksheet!...............................................................................71
Error: Unknown data type '...'!............................................................................................71
Error: Unknown Function '...'!.............................................................................................72
Error: UNTIL expected!......................................................................................................72
Error: UNTIL without REPEAT!..........................................................................................72
Error: Variable not declared!..............................................................................................73
Error: VAR_IN_OUT parameter illegal connected!.............................................................73
Warning: Explicit feedback!................................................................................................73
Warning: Variable is written before in the same network!..................................................74

iii
The Fixed Format LD editor − general information
The topics contained in this help section are specific to the Fixed Format LD editor. Basic editing
and displaying operations which are common to all graphical editors are explained in the general
description of the graphical editor. The same applies to non−specific dialogs.

Editing in the graphical programming language LD is done using the Fixed Format LD editor. This
graphical editor is a cell based editor splitting the LD worksheet into rows and columns building up
the worksheet cells. For that reason all operations you perform are cell−oriented, i.e. operations
such as inserting or moving objects are always done with regard to the cell structure of the
worksheet.

Navigating through the rows and columns in the LD worksheet is done using a cell cursor (see
figure below). Every operation in the LD worksheet, e.g. inserting or connecting objects is
performed by the help of the cell cursor. You can move this cell cursor either by clicking the left
mouse button into a cell or using the arrow keys.

The Fixed Format LD editor provides a powerful auto routing feature which allows you to easily
connect and move objects in your LD worksheet, i.e. the editor determines the routing of any
connection line between two free connection points of two objects automatically.

In addition to the "standard" editing operations used to develop your program, the Fixed Format LD
editor allows you:

• to set the representation of LD worksheets. So it is for example possible to change the


display mode for variables or to change the column width.

• to set the default names for newly created variables.

• to mix the programming languages LD and ST by using program control statements.

• to display and edit the properties of variables, contacts and coils using the dockable
'Property' window.

• Finding and replacing of LD objects (global or local).

• Saving LD worksheets as templates.

1
The Fixed Format LD editor − general information 'Property' window for variables, contacts and coils

• Exporting LD worksheets (source conversion).

'Property' window for variables, contacts and coils


The Fixed Format LD editor provides a 'Property' window in which you can display and edit the
properties of variables, contacts and coils. In difference to the "usual" properties dialogs, the
'Property' window is dockable. 'Dockable' means, that you can detach the window from the desktop
by double clicking on the gray window border. It is then displayed as a usual window, i.e. you can
change the size and move the window to any position on the screen. To reattach it into the desk,
just double click into the blue window title bar.

The 'Properties' window is realized as non−modal dialog, i.e. all other dialogs and areas are
accessible while the 'Property' window is opened.

How to use the 'Property' window

• Open the 'Property' window by selecting 'Property Window' in the submenu 'View'.

• Place the cell cursor on the desired LD object or variable in the LD code body worksheet.
The properties of the object under cursor are visible in the window.

• To edit a property, left click into the corresponding field and enter/select the desired
setting. For a detailed description of each field please refer to the table below.
To insert a variable for the object under cursor, either type the new variable name or
open the list box and select an already declared variable.
Note, that the window must be docked in the user interface in order to edit properties.

• After clicking into any other window, the new entered settings are applied to the previously
marked object/variable.
If you have entered a new variable name, which was not yet declared before, the new
declaration is automatically inserted in the corresponding variables worksheet.

The fields have the following meaning:

Fields which are displayed gray can not be edited for the current object.

Name specifies the name of the variable under cursor. After clicking into
the field, it changes into a list box from which you can select an
already existing variable. All variables which are already declared
for the current POU are provided. If you are entering a new variable
name, it is automatically declared in the related variables
worksheet.

Data Type specifies the data type of the variable under cursor.

Usage specifies the variable keyword. Depending on the POU in which the
variable is (going to be) declared, the list box contains different
variable declaration keywords.

In Program POUs only VAR, VAR_EXTERNAL and


VAR_EXTERNAL_PG can be selected.

2
The Fixed Format LD editor − general information 'Property' window for variables, contacts and coils

In FB POUs the list box contains the keywords VAR_INPUT,


VAR_OUTPUT, VAR_IN_OUT, VAR_EXTERNAL,
VAR_EXTERNAL_PG and VAR_EXTERNAL_FB.
In Function POUs only the keywords VAR and VAR_INPUT can be
selected.

Initial Value specifies the initial value. According to IEC 61131−3 initial values
can optionally be assigned to variables. This means that a variable
which is going to be used for the first time in the PLC program is
used with its initial value. Initial values can be given to variables
with the usage VAR, VAR_GLOBAL, VAR_GLOBAL_PG,
VAR_GLOBAL_FB, VAR_INPUT and VAR_OUTPUT. Initial values
are not possible in declarations with VAR_EXTERNAL,
VAR_EXTERNAL_PG and VAR_EXTERNAL_FB. The initial value
has to fit to the selected data type.

I/O address specifies the variable location in case of a located variable. This
field corresponds to the column 'Address' in the variables grid and
to the variable declaration keyword 'AT' (according to IEC
61131−3).

This is only possible


− in programs with the usage VAR and
− for global variables (VAR_GLOBAL, VAR_GLOBAL_PG and
VAR_GLOBAL_FB).

Description shows an user defined comment. This comment can either be


entered in the field 'Description' of the variables grid worksheet or
on the dialog tab 'Common' of the variable/contact/coil properties
dialog.

RETAIN specifies that a retentive variable is (going to be) declared. The


values of retentive variables are kept even if power is switched off.
In the case of a warm start the last value of the variable is going to
be used.

The keyword RETAIN can be used in combination with the


keywords VAR, VAR_OUTPUT, VAR_GLOBAL,
VAR_GLOBAL_PG and VAR_GLOBAL_FB. It is not possible to
declare retentive variables with the keywords VAR_INPUT,
VAR_EXTERNAL, VAR_EXTERNAL_PG and
VAR_EXTERNAL_FB.

OPC specifies that the variable is written into the *.csv if the checkbox 'All
marked variables' in the dialog 'Resource settings' is activated. Only
necessary if you want to access the variable e.g. using the OPC
Server in order to run a visualization client.

PDD specifies that the variable is written into the PDD if the checkbox 'All
marked variables' in the dialog 'Resource settings' is activated. Only

3
The Fixed Format LD editor − general information Changing the column width in LD worksheets

necessary if you want to access the variable name of an address on


the PLC.

Local Scope specifies the local variables worksheet in which the variable is
(going to be) declared. A variable worksheet can be selected if a
new variable name is entered and several variable worksheets are
available. Otherwise, the field is displayed gray, i.e. no changes are
possible.

Object specifies the object under cursor. (Only available in case of a


contact or coil.) After clicking into the field, it changes into a list box
from which you can select an object. This way it is for example
possible to replace a contact by a coil.

Type specifies the object type. (Only available in case of a contact or


coil.) After clicking into the field, it changes into a list box from which
you can select a type. This way it is for example possible to change
a Set coil into a Reset coil.

Changing the column width in LD worksheets


The width of the first column can not be changed. This column is reserved for left power rails.
The set column width is worksheet−dependent, i.e. you can change the column width for each LD
worksheet individually.

The default column width is defined in the tab 'Graphical editor' of the 'Options' dialog. For that
purpose the dialog field 'Ladder grid width' is provided.

How to change the column width:

• Position the mouse cursor on the vertical column separator right of the column head to be
changed (as shown in the following figure). The mouse cursor changes its shape.

• Press the left mouse button and change the column width to the desired size by moving
the mouse.

• Release the mouse button. The changed column width is applied to all columns in the
active worksheet.

Customizing the representation of the LD worksheet


The Fixed Format LD editor provides several possibilities to customize the representation of the LD
worksheet. So you can:

4
The Fixed Format LD editor − general information Exporting an FF LD code body using source conversion

• change the column width.


Note, that the default color width, adjusted after inserting a worksheet, depends on the
grid setting in the 'Options' dialog.

• change the display mode for variables, i.e. specify which information is displayed in the LD
worksheet.

• change the grid representation. Using the entries of the menu item 'Grid' in the submenu
'Layout' you can choose between the grid presentations 'No', i.e. no grid is invisible,
'Point', i.e. grid points are visible or 'Dotted', i.e. dotted lines are visible.

• display the execution order of functions and function blocks in the LD worksheet after
compiling the worksheet. For a description about this procedure refer to the topic Viewing
the execution order of functions and function blocks.

• view feedbacks in the FBD parts of the LD network in online mode. For a description
about this procedure refer to the topic Viewing feedbacks in FBD networks.

• display or hide the column and row headers. This is done by activating/deactivating the
menu item 'Header' in the submenu 'Layout'. Marking this menu item will display the
headers.

Exporting an FF LD code body using source conversion


The Fixed Format LD editor provides an export function based on the source conversion
functionality of the programming system. Using this function you can convert the contents of an
entire POU into the programming languages IL or FBD or suitable for the older LD editor version.

Basically the LD export function means cross compiling a cell oriented LD worksheet into each of
the mentioned languages.

Prerequisite for each source conversion is that the project which contains the POU to be
converted was already built before (using one of the commands 'Make' or 'Rebuild Project' in the
submenu 'Build'). This is necessary, because the system does not convert the graphical language
elements which are visible in the corresponding worksheets, but the intermediate code, generated
while compiling the project.

How to proceed:

• Make sure, that the project was already built before.

• In the project tree open the subtree 'Logical POUs' and mark the folder icon of the LD
POU to be converted.

• Right click on the icon in order to open its context menu.

• Select the menu item 'Source conversion'.


The dialog 'Source conversion' appears.

• In the dialog mark the checkbox 'Overwrite source POU' if desired, determine the name of
the target POU and mark the desired target language (please refer to the table shown

5
The Fixed Format LD editor − general information Mouse and keyboard operations

below).

• Confirm the dialog.


According to your settings the source POU is converted and the new POU is inserted in
the project tree.

The new POU is not yet compiled after the conversion.

The dialog fields have the following meaning:

Overwrite source POU if this checkbox is marked, the source POU is going to be overwritten
by the converted POU. Otherwise the source POU is not changed
and is available for future use.

Text field this field is used to define a name for the new POU. After opening the
dialog, the system automatically proposes a name. You can either
leave this name unchanged or enter a new name.

Convert to these radio buttons are used to determine the target language. Note
'FBD', 'LD', 'IL' that the option 'LD' means the older LD editor version.

Mouse and keyboard operations in the Fixed Format LD editor


The fixed format LD editor supports full mouse and keyboard handling, i.e. all important commands
and functions can be executed by mouse and keyboard operations.

The following table contains all important keyboard operations and the corresponding mouse
operations.

Operation Keyboard action Mouse action


Moving the cell cursor Pressing the arrow keys Clicking the left mouse button
into the desired cell
Moving the mouse cursor Pressing <Ctrl> + arrow keys Moving the mouse

Marking the current object Pressing the space bar Pressing the left mouse button
as selected
Marking several objects as Pressing <Shift> + space bar; former Pressing <Shift> + left mouse
selected selected objects remain selected button; former selected objects
remain selected
Toggling the selection of Pressing <Ctrl> + space bar; all Pressing <Ctrl> + left mouse
the current cell other selections remain unchanged button; all other selections
remain unchanged

Opening and converting non−Fixed Format LD code bodies


Possibly there are LD code body worksheets in your project which were programmed using the
"old" (not cell oriented) LD editor. When opening such an LD code body, a dialog appears informing

6
The Fixed Format LD editor − general information Rules concerning columns and rows of an LD worksheet

you about this.

The message dialog provides several possibilities to treat the older LD code body version: You can
convert the current worksheet to the newer editor version, you can convert all code worksheets of
the current POU or within the entire project or can open the worksheet using the older LD editor
version (assuming that this editor is installed with you programming system).

Select the desired radio button and confirm the dialog.

Rules concerning columns and rows of an LD worksheet


Please observe the following rules for columns and rows in an LD code body worksheet when
editing LD networks using the Fixed Format LD editor:

• The first column of the worksheet is reserved for the left power rail. There are no other
objects allowed in this column.

• The width of the worksheet columns is identical with the exception of the first column. This
column is smaller than all other columns because it can only contain a left power rail,
representing a network block.

• The width of the column represents the width of a contact/coil.

• The height of rows depends on the content of the highest cell in a row and cannot be
changed. The row height is adjusted automatically to the maximum height of its cells.

• When editing in LD, rows and columns are inserted automatically, e.g. when inserting
objects, connecting objects by auto routing etc.

• There is only one row below the lowermost network block possible, and only one column
right of the most right column, which contains an object.

• Rows are inserted below the row where the cell cursor is positioned and columns are
inserted to the right of the column where the cursor is positioned.

• Specific rows and columns are deleted by positioning the cursor into the desired
row/column, pressing the right mouse button and selecting the desired command from the
context menu (e.g. the menu item 'Delete rows').

Saving an LD code body as template


(Copy to... / Insert from...)
The Fixed Format LD editor provides an enhanced copy function which can be used to save the
entire content of a LD code body worksheet in a file. This file can then be inserted into any other

7
The Fixed Format LD editor − general information Setting default names ...

empty LD code body worksheet.

Therefore this external file can be considered as template.

You can insert data from files created with the Fixed Format LD editor (*.lp) as well as files
generated with the older LD editor version (*.gp).

How to copy the LD code body to an external file:

• Ensure that the worksheet to be copied is the active window.

• Select 'Copy To...' in the submenu 'Edit'.


The dialog 'Save As' appears.

• Select a target directory for the template file and enter a file name (*.lp).
Confirm the dialog.
The template file is written.

How to insert data from a template file into an LD code body worksheet:

Importing data from a *.lp or *.gp file overwrites the current content of the worksheet. No undo is
available to restore overwritten data.

• Ensure that the worksheet into which the LD data should be imported is the active
window.

• Select 'Import from...' in the submenu 'Edit'


A message dialog appears, informing you that the current worksheet content will be
overwritten by the inserted data.
Confirm the dialog to continue.
The 'Open' dialog appears.

• Select the desired file type:


− *.lp for a template file created with the Fixed Format LD editor.
− *.gp for a template file created with an older LD editor version.

• Browse for the desired file and confirm the dialog.


The content of the selected file is inserted to the current worksheet.

Setting default names for newly created contacts/coils and


variables in the current worksheet
The dialog 'Automatically generated variables' is used to set the default variable names applied
when inserting new contacts/coils or variables to the LD worksheet. This way you can define your
own default names or deactivate the automatic insertion of default names.

The dialog is called by selecting the menu item 'Automatically generated variables' in the submenu
'Objects'.

The default settings entered in the dialog fields before changing a value are taken from the tab
'Graphical editor' of the 'Options' dialog.

8
The Fixed Format LD editor − general information Setting editor defaults in the 'Options' dialog

If the automatic assignment of variable names for contacts/coils is deactivated and you insert a
new contact/coil you first have to insert a variable for the new contact/coil.

The dialog fields have the following meaning:

No variable if this checkbox is marked, new contacts and coils are inserted into the LD
worksheet without a variable name. In this case the new variable is not
inserted automatically to the POU's variable list.
If activated, the 'Prefix' and 'Start index contact' fields are grayed out and
therefore disabled.
Prefix / use these input fields to define the prefix and start index used when
Start index contact inserting new contacts and coils to the LD worksheet and automatically to
the POU's variable list.
Example: With the prefix 'C' and start index '0' new contacts or coils are
inserted to the LD worksheet and the POU's variable list with the default
variable names C???, where ??? is the next free index in the POU's
variable list.
Prefix / use these input fields to define the prefix and start index used when
Start index variable inserting new variables into the LD worksheet.
Example: With the prefix 'V' and start index '0' new variables are inserted
to the LD worksheet and automatically to the POU's variable list with the
default variable names V???, where ??? is the next free index in the
POU's variable list.

Setting editor defaults in the 'Options' dialog


The system provides the possibility of setting some defaults for Fixed Format LD code body
worksheets. This is done on the tab 'Graphical editor' and in the tab 'Graphical editor colors' of the
'Options' dialog. To call this dialog select the menu item 'Options...' in the submenu 'Extras'.

Setting network height, width and variable/object defaults

The lower area of the tab 'Graphical editor' provides the following LD specific dialog fields:

Network block defines the number of connection points with which a new network block (left
height power rail) is going to be inserted.

Ladder grid sets the horizontal default width of the grid and therefore the default width of
width the worksheet columns. The default column width can afterwards be changed
in each worksheet individually.

Note: The vertical grid width (row height) depends on the content of the
highest cell in a row and cannot be changed. Please observe the note below.

Prefix defines the prefix and start value used when inserting new contacts and coils
(Contact/Coil) to the LD worksheet and automatically to the POU's variable list.
and Example: With the prefix 'C' and start value '0' new contacts or coils are
Start value inserted to the LD worksheet and the POU's variable list with the default

9
The Fixed Format LD editor − general information Setting the display mode for variables

variable names C???, where ??? is the next free index in the POU's variable
list.

These settings can afterwards be changed in each worksheet individually.


Please observe the note below.

Prefix (Variable) defines the prefix and start value used when inserting new variables into the
and LD worksheet.
Start value Example: With the prefix 'V' and start value '0' new variables are inserted to
the LD worksheet and automatically to the POU's variable list with the default
variable names V???, where ??? is the next free index in the POU's variable
list.

These settings can afterwards be changed in each worksheet individually.


Please observe the note below.

The settings 'Ladder grid width', the 'Prefixes' as well as the 'Start values' for contacts and coils are
only applied to new inserted LD code worksheets. Already existing worksheets are not affected.
The steps how to change the settings for existing worksheets are described in the topics Setting
default names for the current worksheet and Customizing the representation of the current LD
worksheet.

Setting Fixed Format LD editor default colors

Beneath the default settings on the tab 'Graphical editor', it is also possible to define default colors
used in FF LD worksheets. For that purpose, the 'Options' dialog tab 'Graphical editor colors' has to
be opened.

The following table describes the FF LD related settings provided in the colors selection box:

Basic PCS sets the color for Basic Program Control Statements as shown in the sample
illustration in the dialog.
Extended sets the color for Extended Program Control Statements as shown in the sample
PCS illustration in the dialog.
External sets the color for global variables which are defined in the POU using
variables VAR_EXTERNAL. This way, global variables can easily be distinguished from
local variables.
To assign a color, mark the related entry in the selection list and click on 'User defined...' to open
the Windows color pallet. Clicking on 'Reset all colors' resets all user defined color settings to the
predefined manufacturer settings.

Setting the display mode for variables


The Fixed Format LD editor allows to change the display modes for variables in the active LD
worksheet. The following modes are available: Standard, Extended, Full und Extension above.

The set display mode is worksheet−dependent, i.e. you can set the display mode for each LD

10
The Fixed Format LD editor − general information Setting the display mode for variables

worksheet individually.

For printing a single worksheet the current display mode settings are taken. If you use the
command 'Print Project' you can set the display mode for all LD worksheets. For more information
about printing LD worksheets click here.

You can additionally define a different color for external variables. This is done in the 'Options'
dialog.

Changing the display mode is done using the entries of the menu item 'Variables display mode' in
the submenu 'Layout'. The following modes are possible:

Standard
In Standard mode only the variable name is displayed. If the variable has only a direct address or
constant value this value is displayed as shown in the following figure.

Extended
In Extended mode the variable name and, if available, the direct address is displayed. For input
and output formal parameters the data types are displayed. In addition, activating/deactivating the
entry 'Extension above' of the menu item 'Variables display mode' allows to specify whether the
direct address information is displayed above or below the variable name. The following figure
shows an example for an LD network in Extended display mode.

11
The Fixed Format LD editor − general information Setting the display mode for variables

Full
In Full mode the variable name and, if available, the direct address and variable description,
entered in the properties dialog of the variable is displayed. For input and output formal parameters
the data types are displayed. The following figure shows an example for an LD network in Full
display mode.

Extension above
In addition to the Full mode, activating/deactivating the entry 'Extension above' of the menu item
'Variables display mode' allows to specify whether the direct address and variable description
information is displayed above or below the variable name.

12
General editing operations in the Fixed Format LD
editor
Related topics:

Marking objects in LD worksheets

Moving objects in LD worksheets by drag and drop

Moving objects in LD worksheets by inserting/deleting rows or columns

Copying objects in LD worksheets

Cutting objects in LD worksheets

Pasting objects in LD worksheets

Deleting objects in LD worksheets

Using Undo and Redo in LD worksheets

Printing LD worksheets

Copying objects in LD worksheets


The Fixed Format LD editor provides two possibilities for copying objects:

• copying using the clipboard

• copying by the use of the Drag & Drop method

Copied objects can only be inserted to free and valid positions (cells) in the LD worksheet.

It is for example not possible to insert objects to the cell row containing the network block comment.
A valid or invalid insert operation is displayed by the cursor shape as follows:
inserting the objects at the current cursor position is allowed.
inserting the objects at the current cursor position is not allowed.

How to copy objects using the clipboard:

Elements which are copied to the clipboard can be inserted somewhere in the same or in another
worksheet using the menu item 'Paste'.

• Mark the objects you want to copy to the clipboard. Multi−selection is possible.

• Press <CTRL> + <C> or click on the icon 'Copy' in the toolbar to copy the objects.

The dialog 'Copy Control' appears if you have not marked a logical assembly of objects.

13
General editing operations in the Fixed Format LD editor Cutting objects in LD worksheets

• If the dialog 'Copy Control' appears, press the button 'Copy' to copy the logical assembly
of objects to the clipboard or press the button 'Show copy' to see which objects are going
to be copied to the clipboard.

How to copy objects using Drag & Drop:

Using this method, it is not possible to copy an object to another worksheet. For that purpose you
have to use the clipboard as described above.

• Mark the objects you want to copy.

• Press the <CTRL> key and keep it pressed.

• Press the left mouse button and drag the object to be copied to a free and valid position
(refer to note above).

• Release the <CTRL> key and the left mouse button in order to drop the copied objects.

Cutting objects in LD worksheets


In the Fixed Format LD editor you can cut objects and move them to the clipboard.

Using 'Cut' the objects are removed from the worksheet and stored to the clipboard. Logical
assemblies of objects which were cut from a worksheet may differ because the LD editor always
tries to handle legal structures without free (i.e. unused) lines. For this reason the dialog 'Cut
Control' allows you to check which objects are going to be removed from the worksheet and what
you get in the clipboard.

How to proceed:

• Mark the objects to be cut. If desired several objects can be selected.

• Press <CTRL> + <X> or click on the icon 'Cut' in the toolbar to move the objects into the
clipboard.

The dialog 'Cut Control' appears if you have not marked a logical assembly of objects.

• If the dialog 'Cut Control' appears, press the button 'Cut' to extend the marking to a logical
assembly of objects and to cut it to the clipboard or press the button 'Show cut' to show
the logical assembly of objects which is going to be deleted in the worksheet.

Deleting objects in LD worksheets


You can delete one or several objects in the LD worksheet. It is not possible to delete objects so
that illegal structures would result. An illegal structure would be for example an LD network
containing unconnected lines.

If you are deleting contacts or coils in an LD network the other contacts or coils remain at their
place connected with a line. Deleting this line the objects remain with connection points.

14
General editing operations in the Fixed Format LD editor Marking objects in LD worksheets

How to proceed:

• Mark the objects to be deleted.

• Press the key <DEL> to delete the marked object. If you are trying to delete objects which
do not form a logical assembly, the dialog 'Delete control' appears signalizing that the
marked non−legal structure cannot be deleted.

• If the dialog 'Delete control' appears, press the button 'Delete' to extend the marking to a
logical assembly of objects and to delete it or press the button 'Show delete' to show the
logical assembly of objects which is going to be deleted.

Marking objects in LD worksheets


You can mark only one single object or several distinct objects or a group of objects at the same
time using mouse or keyboard operations.

How to mark one single object using mouse or keyboard:

• Click with the left mouse button on the desired object or press the space bar when the cell
cursor points to the object. The marked object changes its color.

How to mark a function/function block:

• Click with the left mouse button on the upper left or right corner of the FU/FB or use the
arrow keys to move the cell cursor to the upper left or right corner of the FU/FB (see the
following figure) and then press the space bar.

How to mark several distinct objects using mouse or keyboard:

• Click with the left mouse button on the first object or press the space bar when the cell
cursor points to the first object. For selecting FU/FBs refer to the description above.

• When using the mouse press the <SHIFT> key and keep it pressed and then click on the
other objects you want to mark
or
when using the keyboard press the <SHIFT> key and keep it pressed. Then move the cell
cursor to the desired objects and press the space bar.

To deselect an object, press the <CTRL> key and either click on the object or press the space bar.
The markings of all other objects remain.

15
General editing operations in the Fixed Format LD edito Moving objects by drag and drop

How to mark a range of objects using the mouse:

• Press the left mouse button and keep it pressed.

• Move the mouse.


A rectangle is displayed indicating the area which is going to be marked.

• Release the mouse button when the rectangle includes all objects to be marked.
The objects are marked.

Some objects are greater than their visible area. That is why you should always draw the rectangle
a bit larger than the visible area of the objects to be marked.

Moving objects in LD worksheets by drag and drop


To organize the structure of an LD POU you can move objects, even if they are connected with
each other. Moving objects is very useful if you have already edited a complex network and you
need more space for inserting new objects. When objects are moved the connections remain after
moving.

Objects can be moved only to free and valid positions (cells) in the LD worksheet.

It is for example not possible to move objects to the cell row containing the network block comment
or to cross connections of an LD network. A valid or invalid move operation is displayed by the
cursor shape as follows:
dropping the objects at the current cursor position is allowed.
dropping the objects at the current cursor position is not allowed.

Connections between moved and not moved objects are routed automatically after dropping. If
dropping is not possible, you get a message and the system stays in the drag mode until dropping
is possible or you cancel the drag and drop operation by pressing the <ESC> key or the right
mouse button.

When moving objects by drag and drop observe the following rules applying to the different LD
objects:

Object To be observed
Contact / Coil Dropping contact/coils on other contacts/coils replace them and dropping
contacts/coils on horizontally lines replace part of the line with the
contact/coil.
Formal parameter Formal parameters can be moved separately. If necessary, the function /
function block belonging to the formal parameter is extended
automatically to the bottom.
Comment Free comments can be placed at any position in the worksheet.
Network block Network blocks can only be moved by selecting all objects connected to
the network block. It is only possible to move network blocks vertically
and they only can be dropped before or behind an other network block in
the first column of the LD worksheet.
Program control If program control statements are part of the selected objects, moving
statement them is only allowed horizontally or vertically, not diagonally.

16
General editing operations in the Fixed Format LD editor Moving objects by inserting/deleting ...

How to move objects by dragging and dropping:

• Mark the objects you want to move. In the following figure a contact and function are to be
moved.

• Press the left mouse button and keep it pressed. The selected objects appear as an
outline box.

• Move the cursor to the desired (valid) position (refer to the note above).

• Release the mouse button to drop the objects. Existing connection lines to other objects
are automatically routed in the LD network.

Moving objects by inserting/deleting rows or columns


You can move objects in the LD worksheet by easily inserting/deleting columns or rows.

By inserting/deleting columns or rows it is possible to

• move objects right of the cell cursor to the right or to the left and

• to move objects below the cell cursor to the bottom or to the top.

How to move objects right of the cell cursor to the right or to the left:

17
General editing operations in the Fixed Format LD editor Pasting objects in LD worksheets

• Click in the worksheet to set the cell cursor or use the arrow keys to position the cell
cursor.

• To move all objects right of the cell cursor to the right, open the editor's context menu and
select the menu item 'Insert Columns' or press the default shortcut <CTRL> + 3.

To move all objects right of the cell cursor to the left, open the editor's context menu and
select the menu item 'Delete Columns' or press the default shortcut <CTRL> + 4.

How to move objects below the cell cursor to the bottom or to the top:

• Click in the worksheet to set the cell cursor or use the arrow keys to position the cell
cursor.

• To move all objects below the cell cursor to the bottom, open the editor's context menu
and select the menu item 'Insert Rows' or press the default shortcut <CTRL> + 1.

To move all objects below the insertion mark to the top, open the editor's context menu
and select the menu item 'Delete Rows' or press the default shortcut <CTRL> + 2.

Pasting objects in LD worksheets


If objects have been cut or copied they are stored in the clipboard. You can paste these objects into
any LD worksheet.

Copied or cut objects can only be pasted to free and valid positions (cells) in the LD worksheet.

It is for example not possible to insert objects to the cell row containing the network block comment.
A valid or invalid insert operation is displayed by the cursor shape as follows:
inserting the objects at the current cursor position is allowed.
inserting the objects at the current cursor position is not allowed.

How to proceed:

• Press <CTRL> + <V> to insert the objects from the clipboard or click on the icon 'Paste'.

The objects to be inserted are displayed as an outline box, i.e. the objects are not
automatically dropped.

• Move the outline box to a valid position in the worksheet using the arrow keys or mouse
and click with the left mouse button or press <RETURN> to drop them.

The objects are placed with the upper left corner of the surrounding rectangle at the cell, marked
with the cursor.

If a collision occurs when dropping the object to a position which is not free, the system cancels the
paste operation automatically. In this case you have to paste the object again and drop it at a free
worksheet position.

18
General editing operations in the Fixed Format LD editor Printing LD worksheets

Printing LD worksheets
When printing LD worksheets or the complete project it is possible to define the display mode for
variables, i.e. which variable information is printed. These display modes are equal to the modes
available in the menu item 'Variables display mode' in the submenu 'Layout'.

For printing a single worksheet the display mode selected while editing the LD worksheet is taken
for printing.

When printing the complete project you can define the display mode to be used for printing all LD
worksheets of your project. This is done in the 'Print Project' dialog.

Global variables are printed with an underlined font. This way, they can easily be distinguished
from local variables.

How to set the display mode when printing the project:

• Choose the menu item 'Print Project' in the submenu 'File'.


The dialog 'Print Project' appears.

• In the 'Variables display mode (LD)' group box activate the radio button

'Standard' − to print only the variable name in LD worksheets. In this print mode the
checkbox 'Extension above' has no effect.

'Extended' − to print the variable name and, if available, the direct address of the variable.
Activate/deactivate the checkbox 'Extension above' to print the direct address information
above/below.

'Full' − to print variable name and, if available, the direct address and variable description.
Activate/deactivate the checkbox 'Extension above' to print the direct address and variable
description information above/below the variable name.

• To print the project, confirm the dialog.

For detailed information about printing the project or single worksheets refer to the topic Printing
and preview.

Using Undo and Redo in LD worksheets


The Undo command

You can use undo in the LD editor to restore the last performed actions.

How to undo the last action:

• Press the shortcut <CTRL> + <Z> or click on the icon 'Undo' in the toolbar.

The Redo command

19
General editing operations in the Fixed Format LD editor Printing LD worksheets

You can use redo in the LD editor to do the steps again, which you have undone using the
command 'Undo'.

How to proceed:

• Press the shortcut <CTRL> + <Y> or click on the icon 'Redo' in the toolbar.

After storing the LD worksheet, no undo or redo is possible in this worksheet.

20
Editing LD networks using the Fixed Format LD
editor
Related topics:

Inserting left power rails (network blocks)

Inserting right power rails

Inserting serial contacts/coils

Inserting parallel contacts/coils (branches)

Inserting variables while editing in LD

Connecting objects in LD worksheets

Inserting connectors while editing in LD

Inserting jumps and labels while editing in LD

Inserting returns while editing in LD

Inserting comments while editing in LD

Inserting functions and function blocks in LD worksheets using the Edit Wizard

Changing the properties of existing contacts or coils

Editing program control statements

Finding and replacing LD objects

Finding and replacing functions and function blocks

Changing the properties of existing contacts or coils


You can change the properties of inserted contacts and coils in LD networks. For example it is
possible to change a normally open contact into a negative transition−sensing contact. It is also
possible to change the variable properties of an object, for example to define an initial value for a
contact.

How to change variable properties of a contact/coil:

Alternatively to the procedure described here, you can use the editor specific 'Property' window for
changing properties or to assign a variable to a contact/coil.

• Double click on the contact or coil to be changed.


The dialog 'Contact/Coil Properties' appears.

21
Editing LD networks using the Fixed Format LD editor Changing the properties of contacts/coils

• On the page 'Contact' you can change the contact/coil type.


Using the radio buttons 'Contact' and 'Coil' and the list box 'Type' you can define the
object type.
The table at the end of this topic shows the symbols representing the different object
types.

• For replacing the current variable by an already declared variable, select the desired
variable in the variables list box on the dialog page 'Contact'. If required mark the radio
button 'Local scope' or 'Global scope'. Proceed as described in the topic How to insert a
variable which is already declared.

For replacing the current variable by a new variable, enter a new name and then
proceed as described in the topic How to insert and declare a new variable.

For changing the properties of the current variable open the dialog page 'Common' and
do the required changes.

• Confirm the dialog 'Contact/Coil Properties' with 'OK'.

How to change the type of several contacts/coils:

You can also change the type of several objects at the same time. If you have e.g. five coils which
you want to change into SET coils you have to mark all coils and change them in one step using
the appropriate icons in the toolbar.

If the icons shown below are not visible in the toolbar, you can assign them to an existing toolbar or
create your own toolbar.

• Mark one or several objects for which the type should be changed.

• Change the type of the marked object(s) by clicking on one of the toolbar icons shown in
the following table.

You can toggle through all available contact and coil types by clicking on the icon 'Toggle
properties of contact/coil' in the toolbar.

The editor additionally provides a Find & Replace functionality which can be used to search for
particular LD objects and replace them by other objects (global and local).

Symbols/icons for the different contact/coil types

The following symbols are used in the list box 'Type' of the dialog 'Contact/Coil Properties' as well
as in the toolbar.

LD object Symbol
normally opened contact
normally closed contact
coil
negated coil

22
Editing LD networks using the Fixed Format LD editor Connecting objects in LD worksheets

SET coil
RESET coil

Connecting objects in LD worksheets


The Fixed Format LD editor provides three possibilities to connect objects in an LD network:

• connecting objects using the connection mode

• connecting objects by drag and drop

• inserting contacts/coils automatically connected to left power rails, contact/coils or


input/output formal parameters of functions and function blocks.

The Fixed Format LD editor provides a powerful auto routing feature. Auto routing means that the
editor will determine the routing of the connection line between two free connection points
automatically.

When connecting objects, observe the following:

• Connection lines are only allowed within the same network block, i.e. if the worksheet
contains several network blocks and you want to connect objects between these network
blocks, an error message is displayed. The same applies to connectors.

• In case of an illegal connection, i.e. if you try to connect an output to another output, an
error message is displayed.

• Connection lines are allowed to cross each other.

• Links between two or three lines are marked with soldering points.

• Connections crossing a program control statement are not allowed.

How to connect objects by drag and drop

The following procedure describes how to connect the input formal parameter 'CU' of the function
block 'CTU' to the output of contact 'C001'. In the same way connecting other objects by drag and
drop is done.

• Mark the function block 'CTU' by clicking in the upper left corner of the function block or
setting the cell cursor to the upper left cell and pressing the space bar.

23
Editing LD networks using the Fixed Format LD editor How to connect objects using the connection mode

• While positioning the mouse cursor on the function block 'CTU', press the left mouse
button and keep it pressed.

• Move the function block to the contact so that the green connection point of the contact
and the connection point of the function block's formal input parameter 'CU' overlap as
shown in the following figure. While moving the mouse the outline box of the function
block is visible showing the position where the object would be dropped when releasing
the mouse button.

• Release the mouse button.


The function block is dropped and the connection is set automatically.

How to connect objects using the connection mode

• Set the cell cursor to the cell which contains the object or connection point (in case of
input/output formal parameters) from which the connection line should start.

24
Editing LD networks using the Fixed Format LD editor Editing program control statements

• Activate the connection mode by pressing <CTRL> + <L> or click on the icon 'Connect
objects' in the toolbar.

A symbol for a connection is added to the mouse cursor.

• Press the <RETURN> key or left mouse button (while the mouse cursor is set on the
object from which the connection line should start).

• Move the cell cursor to the cell containing the destination object and press <RETURN> or
click with the left mouse button on the desired connection point of the destination object.

Editing program control statements


The LD editor allows to combine structured text elements like 'IF', 'CASE', 'WHILE' etc. with LD
objects. This way you can for example control the execution of other objects in LD worksheets,
either other control statements, LD objects or functions/function blocks.

In LD, the structured text elements are inserted as program control statements. There are two
different types of control statements:

• Basic program control statements


For this type of statement the management of the statements is only done in the
statement bar, i.e. the expression of a statement type is defined in the statement bar.

• Extended program control statements


In contrast to basic control statements, these statements use circuits consisting of LD
objects for the expression.

Program control statements are always represented by a seven columns wide bar, called statement
bar (see the figure below). The most left column of the statement bar contains the list box where
the type of statement is chosen. The remaining columns are either automatically filled with the
static texts belonging to the selected statement type or contain user input fields for entering the
expressions or remain empty depending on the selected type.

User input fields and read−only fields of statement bars are displayed in different background
colors. As shown in the following figure for the statement type 'FOR' in a basic program control
statement, the read−only fields ('TO', 'BY' and 'DO') are displayed in another background color than
the user−input fields. These colors can be customized on the tab 'Graphical editor colors' of the
'Options' dialog.

Nesting of program control statements is possible. When compiling the LD worksheet, it is checked
for the correct nesting of program control statements and also the order of statement sequences,
the data types of expressions, variables and CASE values.

25
Editing LD networks using the Fixed Format LD editor Basic program control statements

Basic program control statements

Basic program control statements can be used to control the execution of other objects in LD
worksheets. For this type of program control statements, the management of the statements is only
done in the statement bar, i.e. keyword and relating expressions are part of the statement bar.

The behavior and syntax of program control statements is identical to the statements used in the
programming language ST. This means, for example, that a selection statement such as 'IF' always
requires the terminating statement 'END_IF' to form a legal structure of statements. For detailed
information about programming in ST refer to the topic Editing in ST using the text editor.

Selecting the type of basic program control statement is done in the most left column of the
statement bar.

The following figure shows an example for an LD network consisting of basic program control
statements and LD objects. In this example nesting of the program control statements 'IF' and
'FOR' is done.

The following table details the available basic statement types where the group of statements
belonging to each other are listed in one table cell.

Statement types Remark


IF Expression THEN Expression must have the data type
ELSEIF Expression THEN (ELSEIF optional) 'BOOL'
.
ELSEIF Expression THEN
ELSE
END_IF

CASE Variable OF Variable must have the data type 'INT'.


VALUE case list : Case list represents integer constants.
.
VALUE case list :
ELSE
END_CASE

26
Editing LD networks using the Fixed Format LD editor Extended program control statements

FOR Expression TO Variable BY Variable DO Expression and variables must have


END_FOR the data type 'ANY_INT'.

WHILE Expression DO Expression must have the data type


END_WHILE 'BOOL'.

REPEAT Expression must have the data type


UNTIL Expression 'BOOL'.
END_REPEAT

EXIT Used to abort the execution of a


statement.

Extended program control statements

In contrast to basic control statements, where the expression of a statement type is defined in the
statement bar, extended program control statements use circuits consisting of LD objects for the
expression. For the relating expression the most right variable in the following cell row of the LD
network is always used (see example below).

If the variable used for the expression in the statement is not of the required type, the compiler
generates an error. That means, if for example the control variable within a CASE ... OF statement
is BOOLEAN instead of the expected data type 'INT', an error is generated when compiling the
worksheet.

The behavior and syntax of program control statements is identical to the statements used in the
programming language ST. This means, for example, that a selection statement such as 'IF' always
requires the terminating statement 'END_IF' to form a legal structure of statements. For detailed
information about programming in ST refer to the topic Editing in ST using the text editor.

Selecting the type of extended program control statement is done in the most left column of the
statement bar.

The following figure shows an example for an LD network consisting of extended program control
statements and LD objects. In this example the variable 'OUT010' is used for the expression, i.e. if
this variable has the value 'TRUE' the 'THEN' part of the network is executed.

27
Editing LD networks using the Fixed Format LD editor Extended program control statements

The following table contains the available extended progrom control statement types where the
group of statements belonging to each other are listed in one table cell.

Statement types Remark


IF Expressions must have the data type
(LD network containing control expression) 'BOOL'.
THEN
ELSEIF
(LD network containing control expression)
THEN
.
ELSEIF
(LD network containing control expression)
ELSE
END_IF

CASE OF Control variable must have the data


(LD network containing control variable) type 'INT'. Case list represents integer
VALUE case list : constants.
.
VALUE case list :
ELSE
END_CASE

FOR Control variable and variables must


(LD network containing control variable) have the data type 'ANY_INT'.
TO Variable BY Variable DO
END_FOR

WHILE Expression must have the data type


(LD network containing control expression) 'BOOL'.
END_WHILE

REPEAT Expression must have the data type


UNTIL 'BOOL'.

28
Editing LD networks using the Fixed Format LD editor Inserting and editing program control statements

(LD network containing control expression)


END_REPEAT

EXIT Used to abort the execution of a


statement.

Inserting and editing program control statements

When inserting program control statements, the following rules and restrictions must be
observed:

• Program control statements are only allowed in rows with a connection point of the left
power rail.

• In a row containing a program control statement no other elements are allowed, except
the right power rail.

• No line or connector connections are allowed between networks which are divided by
program control statements.

How to insert a program control statement:

• Move the cell cursor to a cell of an empty row, i.e. there are no other objects than the left
power rail
or
position the cell cursor in a row where a new row below can be inserted.

• To insert a basic program control statement, click on the toolbar icon 'Program Control
statement'.

To insert an extended program control statement, click on the toolbar icon 'Enhanced
Program Control Statement'.

• If the cell cursor is set to an empty row, the program control statement with right power rail
is inserted in this row.
If the cell cursor is set to a row containing LD objects, a new row with the program control
statement and right power rail is inserted below, if allowed.
In both cases the new program control statement is automatically connected to the left
power rail.

How to edit a program control statement:

Once you have inserted the program control statement in the LD worksheet, you can edit the
statement bar, i.e. for basic control statements you can choose the program statement type and
enter the required expressions, variables, constants, etc. and for extended program control
statements you can choose the statement type and enter constants, variables etc.

• To choose the program statement type, double click on the first cell of the statement bar
containing the type of statement. The list box containing the available program statement

29
Editing LD networks using the Fixed Format LD editor Replacing functions and function blocks

types is displayed.

• Open the list box by clicking on the arrow button and select the statement type.

• Confirm the selected type by pressing <RETURN> or clicking in an empty cell of the
worksheet.
The statement bar is automatically updated, i.e. the "elements" belonging to the selected
statement type are automatically displayed. For example, if you have selected the type
'CASE' for a basic program control statement, the relating element 'OF' is automatically
displayed in the statement bar.
Note: Editing fields and non−editing fields of statement bars are displayed in different
colors. As shown in the figure above for the static text 'THEN' another background color is
used than for the editing field left to this static text.

• Enter the values (variables, constants, etc.) for the selected statement type by double
clicking on an editable field as shown in the following figure for the expression of the type
'IF' of a basic program control statement.

• Confirm the entered value by clicking with the left mouse button to an empty cell of the
worksheet.

Replacing functions and function blocks


Like in FBD worksheets you can either replace one particular function/FB using the Edit Wizard or
you can replace several functions or function blocks of one type using the dialog 'Local Replace
FB/FU'.

This topic describes the second method using the replace dialog.

• Choose the menu item 'Replace FB/FU' in the submenu 'Edit'.


The dialog 'Local Replace FB/FU' appears.

• In the field 'Find what:' select the function or function block type to search for.

• In the field 'Replace with:' select the function or function block for replacing.

• Click 'Find Next' to go to the first function or function block to be replaced.

• Click 'Replace all' if you want to replace all functions or function blocks of this type without
having a look at them
or
click 'Replace' if you want to replace them step by step.

30
Editing LD networks using the Fixed Format LD editor Finding and replacing LD objects

Finding and replacing LD objects


When working with the Fixed Format LD editor, the system provides the possibility to search and
replace LD objects. The procedure is similar to the well−known text search/replace. Objects can be
searched either local (in the current active LD worksheet) or global (within the entire project).

For that purpose, the 'Find/Replace' dialogs are extended by new tabs:

• Tab 'Find LD Objects'


• Tab 'Replace LD Objects'
• Tab 'Global Find LD Objects'
• Tab 'Global Replace LD Objects'

While the global tabs are accessible from each worksheet, it is necessary that a FF LD worksheet
is active for calling the local find/replace tabs.

Dialog 'Find/Replace LD Objects' (local)

The tabs 'Find LD Objects' and 'Replace LD Objects' are only available in the dialog 'Find/Replace'
if you are working with the Fixed Format LD editor. This means that an FF LD worksheet must be
active when selecting one of the menu items 'Find...' or 'Replace...' in the submenu 'Edit'.

These tabs are used for searching and replacing LD objects in the active Fixed Format LD
worksheet.

The following table describes the fields and buttons in both LD specific tabs.

Tab 'Find LD Objects'

Find what:Text specifies the name of the LD object to search for.

Find what:Object specifies the object type to search for. Use the list box to select a
type.

Match Case it is searched only for words with same capital and small letters.

Direction: specifies the direction of searching in the worksheet.


'Up' or 'Down'
Find Next goes to the next LD object.

Additional fields and buttons in the tab 'Replace Global'

Replace with: Text specifies the name of the new object.

Replace with: Object specifies the type of the new object.

Replace replaces the first match.

31
Editing LD networks using the Fixed Format LD editor Dialog 'Global Find/Replace LD Objects'

Replace All replaces all matches.

Dialog 'Global Find/Replace LD Objects'

The tabs 'Global Find LD Objects' and 'Global Replace LD Objects' of the dialog 'Find/Replace' are
used for searching and replacing LD objects in all Fixed Format LD worksheets of the project or in
all FF LD worksheets which are marked in the project tree. The dialog is called by selecting one of
the menu items 'Global Find...' or 'Global Replace...' in the submenu 'Edit'.

The following table describes the fields and buttons in both LD specific tabs.

Tab 'Global Find LD Objects'

Find what:Text specifies the name of the LD object to search for.

Find what:Object specifies the object type to search for. Use the list box to select a
type.

Match Case it is searched only for words with same capital and small letters.

Range: specifies the range in which the worksheets are searched for the
'All' or 'Marked' specified object. The radio buttons have the following meaning:

All − If this option is selected, all FF LD worksheets are searched


through. If some object icons are marked in the project tree, these
markings are not considered.

Marked − When activating this option, the system only considers


the FF LD worksheets which are marked in the project tree (or
which are contained in marked POUs).

Direction: specifies the direction of searching in the worksheet.


'Up' or 'Down'
Find Next goes to the next LD object.

Additional fields and buttons in the tab 'Replace Global'

Replace with: Text specifies the name of the new object.

Replace with: Object specifies the type of the new object.

Replace replaces the first match.

Replace All replaces all matches.

32
Editing LD networks using the Fixed Format LD editor Finding LD objects in all worksheets

Finding LD objects in all worksheets

The system provides two possibilities for searching LD objects in the Fixed Format LD worksheets
of a project: The local and the global object search.

Finding LD objects global, as it is described in this topic, is done using the tab 'Global Find LD
Objects' of the dialog 'Find/Replace' and considers all worksheets in the project. It does not matter,
whether the worksheets are opened or not.

The second possibility for searching LD objects is called local search and considers only the active
worksheet. This search engine is described in the topic Finding LD objects in the active worksheet.

How to proceed:

• If you want to search only in some worksheets or POUs within the current project, mark
the related icons in the project tree. To mark several icons, hold the <Ctrl> key pressed
while left clicking on the desired symbols.

• Select the menu item 'Global Find...' in the submenu 'Edit'.


The dialog 'Find/Replace' appears.

• Open the tab 'Global Find LD Objects'.

• In the fields 'Find what: Text/Object' enter the name and select the type of the object to be
replaced.

• Mark one or several of the search options.

• Change the searching direction if desired.

• If you want to search in a range of marked icons (see step 1 in this procedure) activate the
radio button 'Marked'. If the radio button 'All' is activated, the selection you have made in
the project tree is not considered.

• Click on the button 'Find Next' to start the search operation.

How to use the menu items 'Find next (global)' and 'Find Previous (global)':

If you want to search for the same LD object again (either in the search direction 'Up' or 'Down'),
but the dialog 'Find/Replace' is already closed, you don't have to open the dialog again. Just select
one of the menu items 'Find Previous (global)' or 'Find Next (global') in the submenu 'Edit'. The
object specified in the dialog fields 'Find What: Text/Object' is searched again and marked in the
active worksheet.

Finding LD objects in the active worksheet

The system provides two possibilities for searching LD objects in the Fixed Format LD worksheets
of a project: The local and the global object search.

Finding objects local, as it is described in this topic, is done using the tab 'Find LD Objects' of the
dialog 'Find/Replace' and considers only the active worksheet. This means that the FF LD

33
Editing LD networks using the Fixed Format LD editor Replacing LD objects in all worksheets

worksheet must be opened and must be the active window.

The second possibility for searching LD objects is called global search and considers all FF LD
worksheets contained in the project (except in the announced libraries). This search engine is
described in the topic Finding LD objects in all worksheets.

How to proceed:

• Click in the worksheet, where you want to search for an LD object.

• Select the menu item 'Find...' in the submenu 'Edit'.


The dialog 'Find/Replace' appears.

• Open the tab 'Find LD Objects'.

• In the fields 'Find what: Text/Object' enter the name and select the type of the object you
want to search for.

• Mark one or several of the search options.

• Change the searching direction if desired.

• Click on the button 'Find Next' to start the search operation within the worksheet.

How to use the menu items 'Find next (local)' and 'Find Previous (local)':

If you want to search for the same LD object again (either in the search direction 'Up' or 'Down'),
but the dialog 'Find/Replace' is already closed, you don't have to open the dialog again. Just select
one of the menu items 'Find Previous (local)' or 'Find Next (local') in the submenu 'Edit'. The object
specified in the dialog fields 'Find What: Text/Object' is searched again and marked in the active
worksheet.

Replacing LD objects in all worksheets

Replacing LD objects means, that you search for an LD object and replace it automatically by
another LD object. Using the tab 'Global Replace LD Objects' of the dialog 'Find/Replace' this can
be done in all Fixed Format LD worksheets of the project.

Local object replacement (i. e. only the active worksheet is considered) is described in the topic
Replacing LD objects in the active worksheets.

How to proceed:

• If you want to replace LD objects only in some worksheets or POUs within the current
project, mark the related icons in the project tree. To mark several icons, hold the <Ctrl>
key pressed while left clicking on the desired symbols.

• Select the menu item 'Global Replace...' in the submenu 'Edit'.


The dialog 'Find/Replace' appears.

• Open the tab 'Global Replace LD Objects'.

34
Editing LD networks using the Fixed Format LD editor Replacing LD objects in the active worksheet

• In the fields 'Find what: Text/Object' enter the name and select the type of the object to be
replaced.

• In the fields 'Replace with: Text/Object' enter the name and select the type of the new
object.

• Mark one or several of the search options.

• Change the searching direction if desired.

• If you want to search in a range of marked icons (see step 1 in this procedure) activate the
radio button 'Marked'. If the radio button 'All' is activated, the selection you have made in
the project tree is not considered.

• Press the button 'Find Next'.


The first match of this LD object is marked.

• Press the button 'Replace' if you want to replace this match and to go to the next match.

• Press the button 'Replace All' if you want to replace all matches.

Replacing LD objects in the active worksheet

Replacing objects means, that you search for an LD object and replace it automatically by another
LD object. Using the tab 'Replace LD Objects' of the dialog 'Find/Replace' this is done in the
worksheet which is currently active. Global object replacement (i.e. the object is searched and
replaced in all worksheets of the project) is described in the topic Replacing LD objects in all
worksheets.

The tab 'Replace LD Objects' is only available in the dialog 'Find/Replace' if you are working with
the Fixed Format LD editor. This means that an FF LD worksheet must be active when selecting
the menu item 'Replace...' in the submenu 'Edit'.

How to proceed:

• Click in the worksheet, where an LD object is to be replaced.

• Select the menu item 'Replace...' in the submenu 'Edit'.


The dialog 'Find/Replace' appears.

• Open the tab 'Replace LD Objects'.

• In the fields 'Find what: Text/Object' enter the name and select the type of the object to be
replaced.

• In the fields 'Replace with: Text/Object' enter the name and select the type of the new
object.

• Activate the desired search options.

35
Editing LD networks using the Fixed Format LD editor Inserting comments while editing in LD

• Press the button 'Find Next'.


The first match of this LD object is marked.

• Press the button 'Replace' if you want to replace this match and to go to the next match.

• Press the button 'Replace All' if you want to replace all matches.

Inserting comments while editing in LD


In LD worksheets, it is possible to insert:

• free comments at any position in the worksheet, i.e. comments can be placed independent
of the cell structure in the LD worksheet.

• comments automatically fixed to the network block of an LD network.

Comments can overlap with other objects and consist of one or several lines. They are inserted
using the dialog 'Comment' where additionally the font settings can be chosen.

How to proceed:

• To insert a free comment at any position in the LD worksheet, move the cell cursor to the
desired position and click on the toolbar icon 'Insert comment'.

To insert a comment for a network block, double click on the network block.
The dialog 'Comment' appears.

• Enter a comment and change, if required, the font settings.

• Confirm the dialog.


A free comment is inserted with its upper left corner at the upper left corner of the cell the
cursor points to as shown in the following figure.

Comments for network blocks are always inserted right of the network block number.

Inserting connectors while editing in LD


You can insert connectors instead of connection lines if you have long distances between objects.
When executing the program it goes automatically from the output connector to the input connector
with the same name. It is possible to have one output connector and several input connectors with
the same name.

Connectors can only be used within one worksheet and within one network block, i.e. it is not
allowed to link different network blocks or link variables to contacts / coils with connectors. This is
checked when compiling the worksheet.

How to proceed:

36
Editing LD networks using the Fixed Format LD editor Inserting functions and function blocks

• Move the cell cursor to the cell right or left of an object or a formal parameter (input or
output of a function/function block) in the LD worksheet where you want to insert the
connector.

• Click on the icon 'Connector/Jump or Label' in the toolbar.

The dialog 'Connector/Jump' appears.

• Enter a name for the connector.

• Activate the radio button 'Connector'.

• Confirm the dialog.


The connector is inserted connected to the marked object or to the formal parameter.

It is also possible to insert a connector to a cell with no objects in the right or left neighbor cells by
moving the cell cursor to the desired position and then clicking on the icon 'Connector/Jump or
Label' in the toolbar.

Inserting functions and function blocks in LD worksheets


In an LD network also functions and function blocks can be called.

Functions and function blocks are represented as FBD elements, i.e. LD and FBD elements are
mixed in LD code body worksheets.

You can insert a function or a function block

• anywhere in the worksheet to an empty cell and connect it later. In this case, the object is
inserted at the cell cursor position with its upper left corner in the cursor cell as shown in
the following figure:

• directly into an existing line of the LD network. In this case the topmost input and output of
the function/function block will be directly connected to the line.

• directly connected to a formal parameter (input or output) of an already existing


function/function block. In this case the topmost input or output of the new inserted
function/function block will directly be connected to the marked formal parameter of the
existing function/FB. If an input was marked before inserting, the new Fu/FB is connected
at its topmost output and vice versa.

37
Editing LD networks using the Fixed Format LD editor Inserting functions and function blocks

While inserting functions/function blocks the space needed for the objects will be automatically
generated by moving related objects to the left and to the bottom or by inserting rows and columns.

The most comfortable way to insert an FBD function or function block into the LD worksheet is to
use the Edit Wizard, where the method of inserting either a function or a function block is the same.

If you have inserted a new function or function block POU and you want to use it in a worksheet,
compile the variables worksheet of the new POU with 'Compile Worksheet'. You can insert the new
element immediately in your new worksheet having done this compilation.
The command 'Compile Worksheet' of the submenu 'Build' can be used to compile only one
worksheet for detecting syntax errors while developing a project. It is only available if the worksheet
is the active window. Using Compile Worksheet no code is generated.

How to proceed:

• If the Edit Wizard is not visible, press <SHIFT> + <F2> or click on the icon 'Edit Wizard' in
the toolbar.

The Edit Wizard is activated by clicking in the Edit Wizard or pressing <ALT> + <3>.

• Locate the code body position in your worksheet, where the new function or function block
should be inserted and move the cell cursor to this position.
If you want to insert the function/function block directly in an exisiting LD network, select
the connection line between the objects where the new function/function block should be
inserted. You can also mark a formal parameter (input or output) of an already existing
function/function block. Please refer to the list at the beginning of this topic.

• Open the Edit Wizard list box 'Group' and select the desired group of functions or function
blocks.

• Determine the desired function or function block in the Edit Wizard selection area.

• Double click on the desired function or function block.


When inserting a function, it is inserted at the corresponding position without displaying
any further dialogs.
If you are inserting a function block, the dialog 'Variables Properties' appears. In this case
continue with the next item of this procedure.

• In the dialog 'Variables Properties' an instance name for the inserted FB is proposed in the
field 'Name' on the dialog page 'Variables'.
The field 'Name' displays the default instance name (e.g. for a CTU the name 'CTU_n' is
proposed, where n is the first available number which is free for this instance name).
To define the name of the new FB you have the following possibilities:

38
Editing LD networks using the Fixed Format LD editor Inserting jumps and labels while editing in LD

* Enter a new instance name in the field.


* Accept the proposed name.
* Select an already existing name in the instance name list box below the text field.

• If desired, enter a comment concerning the new function block on the dialog tab
'Common'.

• On the tab 'Local Scope' of the dialog 'Variables Properties' mark the group of the local
variables grid worksheet into which you want to insert the new instance declaration. For
that purpose click on the desired group name with the left mouse button.

• Confirm the dialog 'Variables Properties'.


The new function block is inserted automatically in the LD worksheet at the previously
selected cell cursor position with its upper left corner in the cursor cell. Its declaration is
autoinserted into the group of the local variables worksheet, which you have selected on
the page 'Local Scope' of the properties dialog.

By using different colors for functions and function blocks the origin of the related object is
indicated. IEC FIRMWARE FUs/FBs and FUs/FBs from FIRMWARE libraries are displayed in red.
USER FUs/FBs from the same project are displayed in green and USER FUs/FBs from an user
library are displayed in blue.
Please note, that the colors described above are system default colors. If you have changed the
colors using the dialog 'Options', your display may differ from the help information.

The unconnected formal parameters of the function or function block can be connected to other
contacts, coils or variables.

Inserting jumps and labels while editing in LD


While editing in LD jumps can be used. For realizing jumps two objects have to be inserted in your
worksheet: a jump and a label. The label is the target for the jump.

Jump and label belonging together must have the same name and must be placed in worksheets of
the same POU.

Labels are only allowed in empty rows and at the beginning of a network block, i.e. no other objects
are allowed in a row except the left power rail.

How to insert a jump:

• Move the cell cursor to the cell right of the object or the function/function block output in
the LD worksheet where you want to insert the jump.

• Click on the icon 'Connector/Jump or Label' in the toolbar.

The dialog 'Connector/Jump' appears.

• Enter a name for the jump.

• Activate the radio button 'Jump'.

39
Editing LD networks using the Fixed Format LD editor Inserting left power rails (network blocks)

• Confirm the dialog.


The jump is inserted connected to the object or function/function block output.

It is also possible to insert a jump to a cell with no objects in the right or left neighbor cells by
moving the cell cursor to the desired position and then clicking on the icon 'Connector/Jump or
Label' in the toolbar.

How to insert a label:

• Move the cell cursor to any cell of an empty row of a network block where you want to
insert the label.

• Click on the icon 'Connector/Jump or Label' in the toolbar.

The dialog 'Connector/Jump' appears.

• Enter the same name as used for the jump.

• Activate the radio button 'Label'.

• Confirm the dialog.


The label is inserted to the adjacent cell right of the left power rail.

Inserting left power rails (network blocks)


Inserting left power rails (network blocks) is only possible in the first column of the LD worksheet
and between, above or below existing network blocks.

In the following description there is made a difference between:

• Inserting a network block to an empty worksheet.

• Inserting further network blocks to an LD worksheet already containing network blocks.

• Extending an existing network block by additional connection points.

How to insert a network block into an empty worksheet:

• Press <F6> or select the menu item 'Insert a network block' in the editor's context menu or
click on the toolbar icon 'Contact network'.

The first network block with five connection points (fixed number) is inserted to the first
row of the empty LD worksheet.

40
Editing LD networks using the Fixed Format LD editor Inserting parallel LD branches

How to insert further network blocks:

• Move the cell cursor to one of the empty rows between, above or below an existing
network block as shown in the figure above for the first cell row. Only in these rows new
network blocks can be inserted.

• Press <F6> or select the menu item 'Insert a network block' in the editor's context menu or
click on the toolbar icon 'Contact network'.

The new network block is inserted to the worksheet below the already existing network
block(s). The new network block number at the top is automatically incremented.

How to extend an existing network block by additional connection points:

• Move the cell cursor to a cell which row contains a connection point of the network block
to be extended.

• Click on the toolbar icon 'Left power rail' to insert an additional connection point.

If you want to assign a comment to a network block, double click on the network block to open the
dialog 'Comment' and enter the desired text.

Inserting parallel LD branches using the branch edit mode


Parallel objects (i.e. branches) in LD can either be inserted using the appropriate icons or using the
Fixed Format LD editor branch edit mode.

The LD branch edit mode cannot be used if your worksheet is empty. You first have to insert a
network with at least one contact or coil.

How to use the branch edit mode of the Fixed Format LD editor:

• Click on the icon 'Insert LD branch' in the toolbar.

• Move the mouse cursor to the cell where you want to start the branch. If a branch is
possible in the cell under cursor, a symbol for an LD branch is added to the cursor:

Otherwise the following symbol is displayed:

41
Editing LD networks using the Fixed Format LD editor Inserting parallel LD branches

• Left click on the cell where you want to start your parallel branch and keep the mouse
button pressed.
A symbolic contact appears in the appropriate cell as shown below.

• Drag the mouse cursor up or downwards to a free cell while keeping the left mouse button
still pressed.

• Release the mouse button in the desired cell to drop the new object. The object is inserted
with an already drawn left connection line.

The system now automatically changes to the connection mode so that you can draw the
right connection line.

• Move the mouse cursor to the object where the parallel branch should end. Click into the
left half of the appropriate cell to complete the branch.
Note: When clicking into the right half of a cell (means on the output side of a contact/coil)
the system can not establish the connection, because it seems that you want to connect
two outputs.

42
Editing LD networks using the Fixed Format LD editor Inserting parallel contacts/coils

• The contact is now inserted and connected at both sides.

The new contact appears either with or without an assigned default variable
name. This depends on the setting made in the dialog 'Automatically generated
variables'.
If the assignment of default variable names for contacts/coils is enabled, the
dialog 'Contact/Coil Properties' appears where you can define the properties of
the new object.
If the assignment is disabled, the new object is automatically inserted at the
desired position with no contact/coil name. In this case a variable must be
inserted manually for the contact/coil.

• After inserting an object you can change its properties or assign a different variable. This
can be done using the editor specific 'Property' window.

Inserting parallel contacts/coils


Programming in LD allows to insert parallel contacts/coils. So it is possible to insert an object below
or above an already existing one.

The program inserts automatically the object type which you have selected before i.e. if you mark a
contact a new contact is inserted or if you mark a coil a new coil is inserted.

How to insert another parallel object:

• Mark either an existing contact or an existing coil.

43
Editing LD networks using the Fixed Format LD editor Inserting returns while editing in LD

• To insert a new object


− below the selected one, click on the icon 'Add contact/coil below'.

− above the selected one, click on the icon 'Add contact/coil above'.

• The contact/coil is inserted connected at both sides either with an assigned default
variable name or without a variable name. This depends on the setting made in the dialog
'Automatically generated variables'.
If the assignment of default variable names for contacts/coils is enabled, the dialog
'Contact/Coil Properties' appears where you can define the properties of the new object.
If the assignment is disabled, the new object is automatically inserted at the desired
position with no contact/coil name. In this case a variable must be inserted manually for
the contact/coil.

Alternatively you can insert parallel branches using the LD branch edit mode.

After inserting an object you can change its properties or assign a different variable. This can be
done using the editor specific 'Property' window.

Inserting returns while editing in LD


In LD worksheets returns can be inserted for returning back to the calling POU if the Boolean
variable is TRUE. If the variable is FALSE the execution of the current network continues.

How to proceed:

• Move the cell cursor to the cell right of the object in the LD worksheet where you want to
insert the return.

• Click on the icon 'Return' in the toolbar to insert the Return.

It is also possible to insert a return to a cell with no objects in the right or left neighbor cells by
moving the cell cursor to the desired position and then clicking on the icon 'Return' in the toolbar.

Inserting right power rails


Right power rails are optional objects which are used to terminate a network block. They are not
required for compiling the LD worksheet.

It is only possible to insert right power rails connected to a contact or coil which has no connected
objects to the right.

Right power rails are automatically added when inserting a program control statement or a specific
statement box.

How to insert a right power rail:

44
Editing LD networks using the Fixed Format LD editor Inserting serial contacts/coils

• Move the cell cursor on the contact or coil to which the right power rail is to be assigned.

• Click on the toolbar icon 'Right power rail' to insert the power rail.

The right power rail is inserted and automatically connected to the contact/coil selected
before.

Inserting serial contacts/coils


In the Fixed Format LD editor, you have several possibilities to insert contacts and coils. If you
select an already existing object in the LD worksheet and a new contact/coil is to be inserted, the
new object is automatically connected to the object selected before. The editor allows to:

• insert contacts/coils to cells in the LD worksheet with no objects in the neighbor cells to
the right and to the left.

• insert contacts/coils automatically connected to existing contacts/coils.

• insert contacts/coils automatically connected to a free connection point of the left power
rail.

• insert contacts/coils automatically connected to input/output formal parameters.

How to insert a contact/coil:

• To insert a contact/coil to a cell with no objects in the neighbor cells to the right and to
the left, move the cell cursor to a valid position.

To insert a contact/coil automatically connected to existing contacts/coils, mark an


existing contact/coil.

To insert a contact/coil automatically connected to the left power rail, position the cell
cursor in the cell right to the free connection point of the left power rail as shown as
follows:

To insert a contact/coil automatically connected to input/output formal parameters,


position the cell cursor in the horizontal neighbor cell of the input or output formal
parameter as shown as follows:

45
Editing LD networks using the Fixed Format LD editor Inserting variables while editing in LD

• In the toolbar, click on the respective icon.


'Add contact right' or
'Add contact left' or
'Add coil right'

Note: Depending on the marked cell/object only the toolbar icons are available which
ensure the valid insertion of an LD object. For example, if the cell cursor is positioned in
the cell right to a free connection point of the left power rail, only the icons 'Add contact
right' and 'Add coil right' can be selected.

• The contact/coil is inserted either with an assigned default variable name or without a
variable name. This depends on the setting made in the dialog 'Automatically generated
variables'.
If the assignment of default variable names for contacts/coils is enabled, the dialog
'Contact/Coil Properties' appears where you can define the properties of the new object.
If the assignment is disabled, the new object is automatically inserted at the desired
position with no contact/coil name. In this case a variable must be inserted manually for
the contact/coil.

Inserting variables while editing in LD


There are two possibilities to insert variables using the Fixed Format LD editor:

• Inserting variables which have already been declared in the variables worksheet

• Inserting variables which have not been declared in the variables worksheet before

In LD, variables for contacts and coils can alternatively be inserted using the editor specific
'Property' window. This window can also be used to display and edit variable properties.

Declaring and inserting new variables in LD

There are two possibilities to insert a new variable in an LD code body:

• either you can insert a variable for an existing contact/coil. This means, that you have
to change the contact/coil properties and assign it to a new variable. In this case, the
dialog 'Contact/Coil Properties' is used to insert the variable.

• or you can insert a variable which is not a contact/coil. So it is for example possible to
insert a variable into an empty worksheet cell or to insert a variable automatically
connected to an input or output formal parameter of a function/function block. In this case
the dialog 'Variable Properties' is used.

How to insert and declare a new variable for a contact or coil:

• Double click on the contact or coil for which you want to insert a new variable.
The dialog 'Contact/Coil Properties' appears.

• On the page 'Contact' of the dialog 'Contact/Coil Properties' enter the new name in the
field 'Name' and click on the button 'Apply'. The dialog page 'Common' is opened

46
Editing LD networks using the Fixed Format LD editor Inserting variables while editing in LD

automatically.

• On the dialog page 'Common' select the appropriate settings for the contact/coil variable
and click on 'Apply' to confirm the settings.

Note: By selecting the usage, you define, whether you are declaring a local or a global
variable.

• Now you have to define the scope of the new variable, i.e. the variables group into which
the new declaration should be inserted. For that purpose open the dialog page 'Local
scope' if you are declaring a local variable or 'Global scope' in the case of a global
variable.
In the subtree on the dialog page browse for the variables group into which you want to
insert the new variable declaration and mark it with a left mouse click.
Note: If you are declaring a global variable (i.e. usage VAR_EXTERNAL or
VAR_EXTERNAL_PG), you have to select both, a local and a global scope.

• After selecting the scope, click on 'OK'.


The variable appears in the LD worksheet as contact/coil name and its declaration is
automatically inserted into the selected group of the corresponding variables grid
worksheet.
In the case of a global variable, the declaration is inserted into the local variables grid
using the keyword 'VAR_EXTERNAL' and into the global variables worksheet using
'VAR_GLOBAL'.

Please observe the note at the end of this topic.

Alternatively you can use the editor specific 'Property' window for inserting a variable for a
contact/coil.

How to insert and declare a new variable which is not a contact or coil:

• Move the cell cursor to the desired position in the LD worksheet, for example to an empty
cell. To insert a new variable automatically connected to an input or output formal
parameter of a function/function block set the cell cursor to the left neighbor cell (for an
input formal parameter) or the right neighbor cell (for an input formal parameter).

• Click on the icon 'Variable' in the toolbar.

The dialog 'Variable Properties' appears.

• On the page 'Variables' of the dialog 'Variables Properties' enter the new name in the field
'Name' and click on the button 'Apply'. The dialog page 'Common' is opened automatically.

• On the dialog page 'Common' select the appropriate settings for the variable and click on
'Apply' to confirm the settings.

Note: By selecting the usage, you define, whether you are declaring a local or a global
variable.

47
Editing LD networks using the Fixed Format LD editor Inserting already declared variables in LD

• Now you have to define the scope of the new variable, i.e. the variables group into which
the new declaration should be inserted. For that purpose open the dialog page 'Local
scope' if you are declaring a local variable or 'Global scope' in the case of a global
variable.
In the subtree on the dialog page browse for the variables group into which you want to
insert the new variable declaration and mark it with a left mouse click.
Note: If you are declaring a global variable (i.e. usage VAR_EXTERNAL or
VAR_EXTERNAL_PG), you have to select both, a local and a global scope.

• After selecting the scope, click on 'OK'.


The variable is inserted into the LD worksheet at the cell cursor position and its
declaration is automatically inserted into the selected group of the corresponding variables
grid worksheet.
In the case of a global variable, the declaration is inserted into the local variables grid
using the keyword 'VAR_EXTERNAL' and into the global variables worksheet using
'VAR_GLOBAL'.

When inserting a variable into an LD worksheet and an LD object already exists in the right or left
neighbor cell next to the selected cell, the new variable is automatically connected to the object in
the neighbor cell.

If the variables grid worksheet is opened while declaring a new variable in the code body
worksheet, the grid is updated (i.e. the new declaration is inserted into the specified variables
group) automatically without closing the variables worksheet.

Inserting already declared variables in LD

There are two possibilities to insert an already declared variable in an LD code body:

• either you can insert a variable for an existing contact/coil. This means, that you have
to change the contact/coil properties and assign it to a variable which already exists in the
variables worksheet. In this case, the dialog 'Contact/Coil Properties' is used to insert the
variable.

• or you can insert a variable which is not a contact/coil. So it is for example possible to
insert a variable into an empty worksheet cell or to insert a variable automatically
connected to an input or output formal parameter of a function/function block. In this case
the dialog 'Variable Properties' is used.

How to insert an already declared variable for a contact or coil:

• Double click on the contact or coil for which you want to insert a variable into the code
worksheet which is already declared.
The dialog 'Contact/Coil Properties' appears.

• On the page 'Contact' of the dialog 'Contact/Coil Properties' activate the radio button
'Local Scope' if you want to insert a local variable. Activate 'Global Scope' if you want to
insert a global variable.

Depending on the selected scope, the variables list box below the field 'Name' now
contains all local or global variables which are declared in the corresponding local or

48
Editing LD networks using the Fixed Format LD editor Network blocks (left power rails)

global variables worksheet. It does not matter in which group a variable is declared, the
list box shows the content of all groups in the variables worksheet.

• Click on the desired variable in the variables list box. The marked name is entered into the
text field.

• Confirm the dialog.


The variable name appears in the LD worksheet as contact/coil name, i.e. the LD element
is concerned as this variable.

Alternatively you can use the editor specific 'Property' window for inserting a variable for a
contact/coil.

How to insert an already declared variable which is not a contact or coil:

• If you want to insert a variable into the code worksheet which is not a contact or coil,
move the cell cursor to the desired position, e.g. to an empty cell. To insert a variable
automatically connected to an input or output formal parameter of a function/function block
set the cell cursor to the left neighbor cell (for an input formal parameter) or the right
neighbor cell (for an input formal parameter).

• Click on the icon 'Variable' in the toolbar.

The dialog 'Variable Properties' appears.

• On the page 'Variables' of the dialog 'Variable Properties' activate the radio button 'Local
Scope' if you want to insert a local variable. Activate 'Global Scope' if you want to insert a
global variable.

Depending on the selected scope, the variables list box below the field 'Name' now
contains all local or global variables which are declared in the corresponding local or
global variables worksheet. It does not matter in which group a variable is declared, the
list box shows the content of all groups in the variables worksheet.

• Click on the desired variable in the variables list box. The marked name is entered into the
text field.

• Confirm the dialog.


The variable is inserted in the LD worksheet at the desired cell cursor position.

When inserting a variable into an LD worksheet and an LD object already exists in the right or left
neighbor cell next to the selected cell, the new variable is automatically connected to the object in
the neighbor cell.

Network blocks (left power rails)


A left power rail represents a network block. Network blocks "terminate" the LD network on the left
side. In contrast to right power rails, which are optional objects, network blocks are absolutely
necessary for building up a legal LD network and for an error−free compilation.

When working with network blocks, note the following rules:

49
Editing LD networks using the Fixed Format LD editor Network blocks (left power rails)

• In LD worksheets, network blocks are only allowed in the first column of a worksheet.

• Several network blocks are allowed in an LD worksheet.

• By default, network blocks contain five connection points. This default value can be
changed. Free connection points are allowed.

• Extending of network blocks by additional connection points is possible.

• The first cell row belonging to a network block is reserved for the network block number
and network block comment. No other objects are allowed in this row. The network block
number is automatically assigned to the network block and can not be edited. The network
block comment is inserted or edited (in the dialog 'Comment') by double clicking on the
network block.

• LD objects are only allowed in rows with a connection point of the network block.

• Connections between objects in different network blocks are illegal.

• The state of the left power rail in each network block is always to be considered to be ON.

50
Error messages of the FF LD compiler

This topic contains a complete list of the LD specific error messages which can be generated by
the FF LD compiler.

Error: Basic Program Control Statements are not supported!


You have compiled a worksheet which contains Basic Program Control Statements. Your current
programming system version does not support this feature. To be able to compile the worksheet
you have to order the feature separately. Please contact your local distributor.

Error: Cannot resolve generic data type! Please insert a


variable!

A generic data type (ANY_INT, ANY_BIT, etc.) of a function formal parameter cannot be resolved.
You have to split the network and reconnect it using variables.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the cursor marks the position, where the
generic data type cannot be resolved.

• Split your network at this position and reconnect both parts using variables.

Error: Case list empty!


In an FF LD code body you have used the Program Control Statement VALUE with an invalid
integer constant or range.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the Program Control Statement VALUE is
marked.

• Enter a valid integer constant or a range.

51
Error messages of the FF LD compiler Error: Caselist expected!

Error: Caselist expected!


In an FF LD code body you have used a wrong Extended Program Control Statement. After the
Extended Program Control Statement CASE always an Extended Program Control Statement
VALUE has to be used.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
VALUE statement has to be inserted.

• Insert a VALUE statement as described in the topic Inserting and editing program control
statements.

Error: Case list without CASE!


In an FF LD code body the Program Control Statement CASE is missing before the Program
Control Statement VALUE.

How to eliminate the error:

• Double click on the error in the message window.

• The LD code body is opened and the VALUE Program Control Statement is marked
where the CASE statement is missing before.

• Insert an CASE statement as described in the topic Inserting and editing program control
statements.

Error: Connection between different networks!

You have connected different network blocks. This is not allowed. Different network blocks must
neither be connected via a connection line nor using connectors.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the cursor marks the code body position.

• Correct the programming error.

52
Error messages of the FF LD compiler Error: Data type for object '...'! Expected data type '...'!

Error: Data type for object '...'! Expected data type '...'!

The data type of a variable or constant assigned to an object in an FF LD code body worksheet
does not match with the object type.

Examples:

• A contact must be assigned to a variable of the data type BOOL.

• The value of an expression of a Program Control Statement must always be of the


expected data type, e.g. for an IF statement the expression must be of the data type
BOOL, for an CASE statement the expression must be of the data type INT etc.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body worksheet is opened and the object is marked for which the
data type does not match.

• Enter or choose a correct variable for the object.

Error: Data type of accu: '...'! Data type of object: '...'!

The data type of an object is not compatible with the data type of the accu, in which the data type of
the preceding object is stored.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the object is marked, which data type is not
compatible with the data type of the accu.

• Correct the programming error.

Error: DO expected!
In an FF LD code body you have to use the Extended Program Control Statement DO after the
Extended Program Control Statement WHILE.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the DO
statement has to be inserted.

53
Error messages of the FF LD compiler Error: DO without extended WHILE!

• Insert a DO statement as described in the topic Inserting and editing program control
statements.

Error: DO without extended WHILE!


In an FF LD code body the Extended Program Control Statement WHILE is missing before an
Extended Program Control Statement DO.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
WHILE statement has to be inserted.

• Insert a WHILE statement as described in the topic Inserting and editing program control
statements.

Error: ELSE without IF or CASE!


In an FF LD code body the Program Control Statement IF or CASE is missing before a Program
Control Statement ELSE.

How to eliminate the error:

• Double click on the error in the message window.

• The LD code body is opened and the Program Control Statement is marked where the IF
or CASE statement has to be inserted.

• Insert an IF or CASE statement as described in the topic Inserting and editing program
control statements.

Error: ELSEIF without IF!


In an FF LD code body the Extended Program Control Statement IF is missing before an Extended
Program Control Statement ELSEIF.

How to eliminate the error:

• Double click on the error in the message window.


• The LD code body is opened and the Program Control Statement is marked where the IF
statement has to be inserted.

• Insert an IF statement as described in the topic Inserting and editing program control
statements.

54
Error messages of the FF LD compiler Error: ELSEIF without IF!

Error: ELSEIF without IF!


In an FF LD code body the Basic Program Control Statement IF is missing before a Basic Program
Control Statement ELSEIF.

How to eliminate the error:

• Double click on the error in the message window.

• The LD code body is opened and the Program Control Statement is marked where the IF
statement has to be inserted.

• Insert an IF statement as described in the topic Inserting and editing program control
statements.

Error: END_CASE expected!


In an FF LD code body you have probably used the Program Control Statement VALUE after a
CASE−VALUE−ELSE sequence. You have to use the Program Control Statement END_CASE
instead.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
END_CASE statement has to be inserted.

• Insert an END_CASE statement as described in the topic Inserting and editing program
control statements.

Error: END_CASE missing!


In an FF LD code body the Extended Program Control Statement END_CASE is missing after an
Extended Program Control Statement CASE.

How to eliminate the error:

• Double click on the error in the message window.

• The LD code body is opened and the Program Control Statement CASE is marked for
which the END_CASE statement is missing.

• Insert an END_CASE statement as described in the topic Inserting and editing program
control statements.

Error: END_CASE without CASE!


In an FF LD code body the Program Control Statement CASE is missing before a Program Control
Statement END_CASE. This is possible for Basic and Extended Program Control Statements.

55
Error messages of the FF LD compiler Error: END_FOR expected!

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
CASE statement has to be inserted.

• Insert a CASE statement as described in the topic Inserting and editing program control
statements.

Error: END_FOR expected!


In an FF LD code body you have probably used the Extended Program Control Statement DO after
a FOR−DO sequence. You have to use the Extended Program Control Statement END_FOR
instead.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
END_FOR statement has to be inserted.

• Insert a END_FOR statement as described in the topic Inserting and editing program
control statements.

Error: END_FOR missing!


In an FF LD code body the Extended Program Control Statement END_FOR is missing after an
Extended Program Control Statement FOR.

How to eliminate the error:

• Double click on the error in the message window.

• The LD code body is opened and the Program Control Statement FOR is marked for
which the END_FOR statement is missing.

• Insert an END_FOR statement as described in the topic Inserting and editing program
control statements.

Error: END_FOR without FOR!


In an FF LD code body the Program Control Statement FOR is missing before a Program Control
Statement END_FOR. This is possible for Basic and Extended Program Control Statements.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
FOR statement has to be inserted.

56
Error messages of the FF LD compiler Error: END_IF expected!

• Insert a FOR statement as described in the topic Inserting and editing program control
statements.

Error: END_IF expected!


In an FF LD code body the Program Control Statement END_IF is missing after a Program Control
Statement IF or ELSEIF.

How to eliminate the error:

• Double click on the error in the message window.

• The LD code body is opened and the Program Control statement is marked where the
END_IF statement has to be inserted.

• Insert a END_IF statement as described in the topic Inserting and editing program control
statements.

Error: END_IF missing!


In an FF LD code body the Extended Program Control Statement END_IF is missing after an
Extended Program Control Statement IF.

How to eliminate the error:

• Double click on the error in the message window.

• The LD code body is opened and the Program Control Statement IF is marked for which
the END_IF statement is missing.

• Insert an END_IF statement as described in the topic Inserting and editing program
control statements.

Error: END_IF without IF!


In an FF LD code body the Program Control Statement IF is missing before a Program Control
Statement END_IF.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the IF
statement has to be inserted.

• Insert an IF statement as described in the topic Inserting and editing program control
statements.

57
Error messages of the FF LD compiler Error: END_REPEAT expected!

Error: END_REPEAT expected!


In an FF LD code body you have to use the Program Control Statement END_REPEAT after the
Program Control Statement UNTIL of a REPEAT loop.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
END_REPEAT statement has to be inserted.

• Insert an END_REPEAT statement as described in the topic Inserting and editing program
control statements.

Error: END_REPEAT missing!


In an FF LD code body the Extended Program Control Statement END_REPEAT is missing after
an Extended Program Control Statement REPEAT.

How to eliminate the error:

• Double click on the error in the message window.

• The LD code body is opened and the Program Control Statement REPEAT is marked for
which the END_REPEAT statement is missing.

• Insert an END_REPEAT statement as described in the topic Inserting and editing program
control statements.

Error: END_REPEAT without REPEAT!


In an FF LD code body the Program Control Statement REPEAT is missing before a Program
Control Statement END_REPEAT.

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
REPEAT statement has to be inserted.

• Insert a REPEAT statement as described in the topic Inserting and editing program control
statements.

Error: END_WHILE expected!


In an FF LD code body you have probably used the Extended Program Control Statement DO after
a DO statement of a WHILE loop. You have to use the Extended Program Control Statement
END_WHILE instead.

How to eliminate the error:

58
Error messages of the FF LD compiler Error: END_WHILE missing!

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
END_WHILE statement has to be inserted.

• Insert a END_WHILE statement as described in the topic Inserting and editing program
control statements.

Error: END_WHILE missing!


In an FF LD code body the Extended Program Control Statement END_WHILE is missing after an
Extended Program Control Statement WHILE.

How to eliminate the error:

• Double click on the error in the message window.

• The LD code body is opened and the Program Control Statement WHILE is marked for
which the END_WHILE statement is missing.

• Insert an END_WHILE statement as described in the topic Inserting and editing program
control statements.

Error: END_WHILE without WHILE!


In an FF LD code body the Program Control Statement WHILE is missing before a Program
Control Statement END_WHILE.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
WHILE statement has to be inserted.

• Insert a WHILE statement as described in the topic Inserting and editing program control
statements.

Error: Exit without iteration statement!


The Program Control Statement EXIT must only be used within loops. This applies for Basic and
Extended Program Control Statements.

Loops are defined by

• FOR...END_FOR

• WHILE...END_WHILE

• REPEAT...UNTIL...END_REPEAT

How to eliminate the error:

59
Error messages of the FF LD compiler Error: Extended Program Control Statements not supported!

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement EXIT is marked.

• Delete the statement EXIT or move it to a valid position within a loop.

Error: Extended Program Control Statements not supported!


You have compiled a worksheet which contains Extended Program Control Statements. Your
current programming system version does not support this feature. To be able to compile the
worksheet you have to order the feateure separately. Please contact your local distributor.

Error: FB instance '...' not declared!

A function block instance of a function block used in a FF LD code body worksheet can not be
found in the variables declaration worksheet. It is also possible that there is a typing error in the
function block name.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the concerning function block is marked.

• Check the typing of the function block name.

• Declare the function block instance in the variables declaration worksheet.

Error: Final value and step value of FOR loop expected!


In an FF LD code body the Extended Program Control Statement DO is missing after an Extended
Program Control Statement FOR. Here you have to define the final value and step value.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the DO
statement has to be inserted.

• Insert a DO statement as described in the topic Inserting and editing program control
statements.

• Enter the final value and step value for the DO statement.

Error: Final value and step value without extended FOR!


In an FF LD code body the Extended Program Control Statement FOR is missing before an
Extended Program Control Statement TO.

60
Error messages of the FF LD compiler Error: Function formal parameter not connected!

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
FOR statement has to be inserted.

• Insert a FOR statement as described in the topic Inserting and editing program control
statements.

Error: Function formal parameter not connected!

You have inserted a function in an FF LD code body worksheet which input parameter is not
connected to other elements.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the input parameter of the function, which is not
connected, is marked.

• Connect the input parameter to an element.

Error: Illegal case list!


You have used a value for a case statement which is not allowed. The values for a case statement
must be of the data type INT. Ranges are allowed from −32768 up to 32767.

Example:

INT constant: 100 (or several constants separated by commas: 100,200,300)

Range: 100..200

The values in the different expressions of a case statement must not overlap.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the affected Program Control statement is marked.

• Correct the syntax or range of the value.

61
Error messages of the FF LD compiler Error: Illegal network!

Error: Illegal network!

You have connected a formal parameter with the result of an explicit feedback and a further signal.
This is not allowed.

Example:

How to eleminate the error:

• Double click on the error in the message window.


The LD code body is opened and the affected output parameter is marked.

• Correct the programming error.

Error: Illegal object at right power rail!

You have connected an illegal object to a right power rail. Only coils can be connected to right
power rails.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the illegal object is marked.

• Correct the programming error.

Error: Illegal subscript to array: '...'!

An illegal index is used to access an array. The index either represents an array itself or a structure
or the data type of the index is not ANY_INT.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the cursor marks the code body position.

62
Error messages of the FF LD compiler Error: Illegal usage of data type '...'!

• Correct the programming error.

Error: Illegal usage of data type '...'!


You have accessed an element of an array or a structure or a combination of both in a wrong way.
This means, that the access on the element is not consistent with the definition of the user defined
data type in the data type worksheet.

Examples:

• You have accessed an element of an one dimensional array as follows:


MyOneDimensionalArray[1][2]
instead of MyOneDimensionalArray[2].

• You have accessed an element of an array as follows: MyArray.1


Correct is MyArray[1].

• You have accessed an element of a structure as follows: MyStruct[elem_name]


instead of MyStruct.elem_name.

• You have accessed an element of a structure in an array which does not exist:
MyArrayOf_INT[1].element.
An array of integers cannot contain structures. For that purpose an array of structures has
to be declared.

Detailed information about the user defined data types and arrays and structures can be found in
the topic User defined data types.

Error: Incomplete assignment!


An assignment is expected in a Program Control Statement. You have either entered only a
variable or you have forgotten to assign the expression. It is also possible that there is a typing
error.

Example:

variable name := expression;

How to eliminate the error:

• Double click on the error in the message window.


The LD worksheet is opened and the affected Program Control Statement is marked.

• Correct the programming or typing error.

63
Error messages of the FF LD compiler Error: Label placed inside network!

Error: Label placed inside network!

You have used a label which is positioned inside a network. This is not allowed. Labels have to be
placed above or below a network.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the cursor marks the label.

• Correct the programming error.

Error: Missing name!


The compiler has detected a contact or coil in an FF LD code body worksheet to which no variable
name is assigned.

The Fixed Format Ladder editor allows to insert contacts and coils without a default variable name
(depending on the settings in the dialog 'Automatically generated variables'). In this case a variable
must be assigned manually to the particular LD object.

• Double click on the error in the message window.


The LD code body is opened and the cursor marks the object without variable.

• Double click on the object to call the dialog 'Contact/Coil Properties'.

• In the dialog 'Contact/Coil Properties' either select an already declared variable or declare
a new variable.

How to insert an already declared variable:

• On the page 'Contact' of the dialog 'Contact/Coil Properties' activate the radio button
'Local Scope' if you want to insert a local variable. Activate 'Global Scope' if you want to
insert a global variable.

Depending on the selected scope, the variables list box below the field 'Name' now
contains all local or global variables which are declared in the corresponding local or
global variables worksheet. It does not matter in which group a variable is declared, the
list box shows the content of all groups in the variables worksheet.

• Click on the desired variable in the variables list box. The marked name is entered into the
text field.

• Confirm the dialog.


The variable name appears in the LD worksheet as contact/coil name, i.e. the LD element
is concerned as this variable.

How to insert and declare a new variable:

64
Error messages of the FF LD compiler Error: Missing Data!

• On the page 'Contact' of the dialog 'Contact/Coil Properties' enter the new name in the
field 'Name' and click on the button 'Apply'. The dialog page 'Common' is opened
automatically.

• On the dialog page 'Common' select the appropriate settings for the contact/coil variable
and click on 'Apply' to confirm the settings.

Note: By selecting the usage, you define, whether you are declaring a local or a global
variable.

• Now you have to define the scope of the new variable, i.e. the variables group into which
the new declaration should be inserted. For that purpose open the dialog page 'Local
scope' if you are declaring a local variable or 'Global scope' in the case of a global
variable.
In the subtree on the dialog page browse for the variables group into which you want to
insert the new variable declaration and mark it with a left mouse click.
Note: If you are declaring a global variable (i.e. usage VAR_EXTERNAL or
VAR_EXTERNAL_PG), you have to select both, a local and a global scope.

• After selecting the scope, click on 'OK'.


The variable appears in the LD worksheet as contact/coil name and its declaration is
automatically inserted into the selected group of the corresponding variables grid
worksheet.
In the case of a global variable, the declaration is inserted into the local variables grid
using the keyword 'VAR_EXTERNAL' and into the global variables worksheet using
'VAR_GLOBAL'.

Error: Missing Data!


There is an empty editing field of a Basic Control Statement.

How to eliminate the error:

• Double click on the error in the message window.

• The LD code body is opened and the Program Control Statement is marked containing the
empty editing field.

• Enter a value (variable, constant, etc.) for the statement type.

Error: Missing expression!


In an FF LD code body, Extended Program Statements use LD networks for the expression. Such
an LD network is missing.

How to eliminate the error:

• Double click on the error in the message window.

• The LD code body is opened and the Program Control Statement is marked where the LD
network has to be inserted.

65
Error messages of the FF LD compiler Error: Mixed Program Control Statements

• Insert an LD network used as expression for the control statement.

Error: Mixed Program Control Statements between normal style


and extended style!
In an FF LD code body you have mixed Basic and Extended Program Control Statements, e.g. a
basic statement type IF and an extended statement type END_IF form a sequence.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the affected Program Control Statement is marked.

• Exchange the Program Control Statement to form a sequence of one statement type.

Error: Nesting level too deep!


You have nested more than 30 brackets and functions in a Program Control Statement.

How to eliminate the error:

• Double click on the error in the message window.


The LD worksheet is opened and the affected position is marked.

• Reduce the number of nested brackets and functions.

Error: Networks are overlapping!

Different networks must not overlap horizontally. This ensures that the execution order is clearly
visible.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the cursor marks the code body position.

• Restructure your network.

Error: Object illegal connected!

An object in an FF LD code body worksheet is not connected according to IEC 61131−3 (for
example it is not allowed to connect several objects to an output).

66
Error messages of the FF LD compiler Error: Operand expected in expression!

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the cursor marks the code body position.

• Correct the programming error.

Error: Operand expected in expression!


An operand for an expression of a Program Control Statement is missing. It is also possible that
there is a typing error.

How to eliminate the error:

• Double click on the error in the message window.


The LD worksheet is opened and the affected Program Control Statement is marked.

• Correct the programming or typing error.

Error: Operator expected in expression!


Missing operator in an expression of a Program Control Statement. It is also possible that there is a
typing error.

How to eliminate the error:

• Double click on the error in the message window.


The LD worksheet is opened and the affected Program Control Statement is marked.

• Correct the programming or typing error.

Error: Parentheses error!


An opening or a closing parenthesis is missing or too many opening or closing parentheses are
used in an expression of a Program Control Statement.

How to eliminate the error:

• Double click on the error in the message window.


The LD worksheet is opened and the affected Program Control Statement is marked.

• Check the parentheses and correct the programming or typing error.

Error: Program Control Statement may only be connected to left


or right powerrail!
In an FF LD code body a Program Control Statement is connected to an object type which is not a
left or right power rail. This is not allowed.

67
Error messages of the FF LD compiler Error: Program Control Statement may only be connected ...

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the concerning Program Control Statement is
marked.

• Connect the Program Control Statement to the left or right power rail.

Error: Program Control Statement may only be connected to left


or right powerrail!
In an FF LD code body a Program Control Statement is connected to an object type which is not a
left or right power rail. This is not allowed.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the concerning Program Control Statement is
marked.

• Connect the Program Control Statement to the left or right power rail.

Error: Program Control Statements not supported!


You have compiled a worksheet which contains Program Control Statements. Your current
programming system version does not support this feature. To be able to compile the worksheet
you have to order the feature separately. Please contact your local distributor.

Error: Sequence of Program Control Statements splitted into


several Network Blocks!
In an FF LD code body, a sequence of Program Control Statements has to be connected to the
same network block (left powerrail). For example, the sequence must not start at network block 001
and end at network block 002. This applies for Basic and Extended Program Control Statements.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
sequence of statements starts.

• Arrange the Program Control Statements in a way that all parts of the sequence are
connected to the same network block.

68
Error messages of the FF LD compiler Error: SFC not supported!

Error: SFC not supported!


The SFC worksheet, which was programmed using the "old" (not cell oriented) LD editor, was
compiled using the "new" compiler. Please call the technical support.

Error: Short or illegal wired or!

One or several objects are short circuited via a connection line or a wired OR exists.

Example for a wired OR:

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the cursor marks an output parameter.

• Correct the programming error.

Error: Syntax Error!


You have used assignments or expressions in a Program Control Statement which are not allowed.
It is also possible that there is a typing error.

How to eliminate the error:

• Double click on the error in the message window.


The LD worksheet is opened and the affected Program Control Statement is marked.

• Correct the programming or typing error.

Error: THEN expected!


In an FF LD code body the Extended Program Control Statement THEN is missing after an
Extended Program Control Statement IF or ELSEIF.

69
Error messages of the FF LD compiler Error: THEN without extended IF!

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the cursor marks the affected cody body position (for
example the END_IF statement after which the statement THEN has to be inserted).

• Insert a THEN statement as described in the topic Inserting and editing program control
statements.

Error: THEN without extended IF!


In an FF LD code body the Extended Program Control Statement IF is missing before an Extended
Program Control Statement THEN.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Extended Program Control statement is marked
where the IF statement has to be inserted.

• Insert an IF statement as described in the topic Inserting and editing program control
statements.

Error: Too many arguments for function '...'!


A FF LD code body worksheet contains a function which has too many arguments (e.g. in the
expression of a Program Control Statement: LEN ('abc', 'def')).

Possible reasons:

• There is a typing error.

• In case of an user POU or a POU taken from an announced user library: The function
prototype has been changed.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the cursor marks the affected code body position.

• Correct the programming error.

Error: Too many explicit feedbacks or wired or per network!

A network in an FF LD code body worksheet contains 100 or more explicit feedbacks, short circuits
or wired ORs. Short circuits and wired ORs are not allowed. The explicit feedbacks can be resolved
by inserting variables instead.

70
Error messages of the FF LD compiler Error: Too many objects in worksheet!

Example of a wired OR:

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body worksheet is opened and the cursor marks an output
parameter.

• Replace the explicit feedback by a variable.

Error: Too many objects in worksheet!


You have used too many objects in your worksheet. It is not possible to compile this worksheet.
You have to reduce the number of objects or to split your worksheet into two or more worksheets.

How to eliminate the error:

• Double click on the error in the message window.


The worksheet containing too many objects is opened.

• Reduce the number of objects or split your worksheet.

Error: Unknown data type '...'!

The data type of a structure or an array used in an FF LD code body worksheet is not defined. It is
also possible that there is a typing error.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the cursor marks the code body position.

• Correct the programming or typing error.

71
Error messages of the FF LD compiler Error: Unknown Function '...'!

Error: Unknown Function '...'!

A function used in an FF LD code body worksheet (for example in the expression of a Program
Control Statement) can not be found.

Possible reasons:

• There is a typing error in the function name.

• In case of an user POU or a POU taken from an announced user library: The user POU or
the user library has been deleted.

• The PLC and/or processor type for the affected POU has been changed so that the
missing function is no longer supported/available with the current PLC/processor type.

How to eleminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the cursor marks the code body position.

• Correct the programming error.

Error: UNTIL expected!


In an FF LD code body you have used the Program Control Statement END_REPEAT after the
Program Control Statement REPEAT. The compiler expects the end condition UNTIL after the
statement REPEAT.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
UNTIL statement has to be inserted.

• Insert an UNTIL statement as described in the topic Inserting and editing program control
statements.

Error: UNTIL without REPEAT!


In an FF LD code body the Program Control Statement REPEAT is missing before a Program
Control Statement UNTIL. This is possible for Basic and Extended Program Control Statements.

How to eliminate the error:

• Double click on the error in the message window.


The LD code body is opened and the Program Control statement is marked where the
REPEAT statement has to be inserted.

72
Error messages of the FF LD compiler Error: Variable not declared!

• Insert a REPEAT statement as described in the topic Inserting and editing program control
statements.

Error: Variable not declared!


A variable which is used in the graphical code body worksheet is not declared in the variables grid
worksheet.

How to eliminate the error:

• Double click on the error in the message window.


The LD worksheet is opened and the affected Program Control Statement is marked.

• Declare the variable in the variables grid worksheet.

Error: VAR_IN_OUT parameter illegal connected!

You have used a formal parameter of the type VAR_IN_OUT which is not connected correctly.

Possible reasons:

• You have connected several objects to the input or output.

• You have only connected the output.

• You have connected different variables to the input and output.

• You have connected a function to the formal parameter.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the formal parameter is marked.

• Correct the programming error.

Warning: Explicit feedback!


The compiler has detected an explicit feedback in an FF LD code body worksheet. The explicit
feedback may be a non−intended programming error or the network behavior is different from the
expected behavior.

How to eliminate the error:

• Double click on the warning in the message window.


The affected LD code body worksheet is opened and the cursor marks an output
parameter.

73
Error messages of the FF LD compiler Warning: Variable is written before in the same network!

• Please check if the explicit feedback is required or if there is a programming error.

Warning: Variable is written before in the same network!

This message is a warning. Before reading the value of a variable in a network, a write process to
the variable occurs. This can change the function of the network negatively. You have to check
your network behavior.

How to eliminate the error:

• Double click on the error in the message window.


The affected LD code body is opened and the object is marked, from which a read access
is performed after it was written to this variable.

• Check your program.

74

Vous aimerez peut-être aussi