FBD/LD/IL Editor

The FBD/LD/IL editor is a combined editor of the programming languages FBD, LD and IL.

Note

If necessary, IL can be activated in the CODESYS options.

There is a common set of commands and elements and CODESYS automatically converts the 3 programming languages into one another internally.

The code in the implementation part is structured in all three languages with the aid of networks.

The FBD/LD/IL menu provides the commands for working in the editor.

In offline and online modes, you can switch editors at any time by using the menu command in View.

The behavior of the FBD/LD/IL editor is defined by the settings in Tools ‣ Options (category FBD, LD and IL).

Hint

There are some special elements that CODESYS cannot convert and thus it displays only in the applicable language. There are also constructs that are not clearly convertible between IL and FBD and are therefore ‘normalized’, i.e. nullified, when converted back to FBD. This concerns: negation of expressions and explicit/implicit assignment of function block inputs and outputs.

An error-free conversion between the languages requires syntactically correct code. Otherwise parts of the implementation can be lost.

See also

FBD and LD editor

Inserting and arranging elements

You can drag elements with the mouse from the view Tools (toolbox) into the implementation part of the editor. Alternatively you can use the commands of the context menu or the FBD/LD/IL menu.

Settings for the display and interface are defined in the CODESYS options, category FBD/LD/IL.

If you drag an element with the mouse over a network in the editor, all possible insertion positions are displayed with gray diamond-shaped, triangular or arrow-shaped position marks. As soon as the mouse pointer is located over one of these marks, the mark turns green. If the mouse button is now released, CODESYS inserts the element at this position.

Example

If you drag a function block or an operator from the toolbox or a network at the left-hand side of the network onto one of the two arrows, then CODESYS automatically creates a new network and inserts the element there.

In order to replace an element, drag a suitable other element onto its position with the mouse. Elements that you can replace by the new element are marked by CODESYS in the editor with text fields, for example Replace, Attach input.

You can use the usual commands in the menu Edit for cutting, copying, pasting and deleting elements. Copying also works with drag-and-drop by holding down the Ctrl key.

Hint

The operators with EN/ENO functionality can only be inserted in the FBD and IL editors.

Selecting elements

A box or a connecting line in the editor is selected by clicking on it with the mouse so that it has the focus. Multiple selection is possible by keeping the Ctrl key pressed. A selected element is shaded red.

Tooltip

If the cursor points to certain elements, for example to a variable or to an input, a tooltip appears showing information about this element.

In the case of elements underlined with a wavy red line, the tooltip shows the pre-compile error message of the error that occurs with this element.

Navigating in the editor

Navigating in the editor

With the help of the keys and commands described below, you can place the focus within the editor on a different cursor position. The change between the positions is also network-spanning in function.

Change to the neighboring cursor position, along the signal flow, i.e. from left to right and vice versa.

Change to the next cursor position above or below the current position, if this neighboring position belongs to the same logical group. For example, all connections of a box form a logical group.

If such a logical group does not exist: change to the first cursor position in the next higher or lower neighboring element. In the case of parallel-connected elements, navigation takes place along the first branch.

Ctrl + Home

Change to the first network; this will be selected.

Ctrl + End

Change to the last network; this will be selected.

Page Up

Scroll upwards by one page; the highest network on this page is selected.

Page Down

Scroll downwards by one page; the lowest network on this page is selected.

Command Go to…

Change to a certain network.

Opening function blocks

If a function block is inserted in the editor, then you can open its implementation by a double-click or with the context menu command Browse for symbol ‣ Go to Definition .

See also

IL editor

Inserting and arranging elements:

You can insert elements with the help of the commands of the menu FBD/LD/IL in the context menu. You can also drag a new network from the tool box into the implementation part of the editor by drag-and-drop.

You can use the usual commands in the menu Edit for cutting, copying, pasting and deleting elements. Copying also works with drag-and-drop by holding down the Ctrl key.

Hint

Please note that operators with EN/ENO functionality can only be inserted in the FBD and IL editors.

Each program line is entered in a table row.

Structure of networks in the IL editor

1st line: Network title

Requirement: The option is activated in the CODESYS options.

2nd line: Network comment

Requirement: The option is activated in the CODESYS options.

3rd line and on:

Column

Contents

Description

1

Operator

Contains the IL operator (LD, ST, CAL, AND, OR, etc.) or a function name. If you call a function block, you must additionally specify the corresponding parameters here; in the preceding field you must enter in this case := or =>.

2

Operand

Contains precisely one operand or the name of a jump label.

In the case of several operands you must enter them in several rows and when doing so insert a comma directly behind the individual operands. (See example below)

3

Address

Contains the address of the operand as defined in its declaration.

non-editable

You can activate/deactivate the display via the option Display symbol address. To do this, select the command Tools ‣ Options and the General tab in the category FBD, LD and IL.

4

Symbol comment

Contains the comment that was specified for the operand if necessary in the declaration.

non-editable

You can activate/deactivate the display via the option Display symbol comment if you select the command Tools ‣ Options and the General tab in the category FBD, LD and IL.

5

Operand comment

Comment for the current program line.

You can activate/deactivate the display via the option Operand comment if you select the command Tools ‣ Options and the General tab in the category FBD, LD and IL.

Example

Navigating in the editor

Key(s)/command

Cursor movement

Jumps to the field located above/below.

Tab

Jumps one field to the right within the row.

Shift + Tab

Jumps to the left to the preceding field within the row

Space

Opens the editing frame for the selected field. Alternatively you can click with the mouse on the field. If applicable the button for the input assistant dialog box is available.

Ctrl + Enter

Inserts a new row below the current row.

Del

Deletes the current row.

Ctrl + Home

Sets the focus at the start of the document and marks the first network.

Ctrl + End

Sets the focus at the end of the document and marks the last network.

Page Down

Scrolls up by one page and marks the top rectangle.

Page Up

Scrolls down by one page and marks the top rectangle.

See also