FBD/LD/IL Editor

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

FBD/LD/IL Editor 1:

If required, IL can be enabled via the TwinCAT options. (Tools > Options > TwinCAT > PLC Environment > FBD, LD and IL > IL)

There is a common set of commands and elements, and TwinCAT automatically converts the three programming languages internally.

The code in the implementation part is structured in all three languages using networks.

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

In offline and online mode, you can switch between the three editor views at any time using the command.

The behavior of the FBD/LD/IL editor is determined by the settings in the menu Tools > Options, category TwinCAT > PLC Environment > FBD, LD and IL.

FBD/LD/IL Editor 2:

There are some special elements that TwinCAT cannot convert and thus only displays in the appropriate language. Similarly, there are constructs which cannot be unambiguously converted between IL and FBD and are therefore "normalized", i.e. canceled, when converted back into FBD. This concerns: negation of expressions and explicit/implicit assignment of function block inputs and outputs.

See also:

FBD and LD editor

Inserting and arranging items:

You can move elements from the Toolbox view to the implementation part of the editor by dragging them with the mouse. Alternatively, you can use the commands of the context menu or the menu FBD/LD/IL.

Settings relating to display and interface are defined in the TwinCAT options, category TwinCAT > PLC Environment > FBD, LD and IL.

When you drag an element with the mouse over a network in the editor, all possible insertion positions are displayed with gray diamond, triangle or arrow-shaped position marks. When the mouse pointer is positioned over one of these markers, the marker turns green, and TwinCAT inserts the element at the position when the mouse button is released.

Example:

FBD/LD/IL Editor 3:

When you drag a function block or operator from the Toolbox or a network to the left edge of the network onto one of the two arrows, the following happens: TwinCAT automatically creates a new network and inserts the element there.

To replace an element, use the mouse to drag a suitable other element to its position. In the editor, TwinCAT identifies elements that can be replaced by the new element with text fields, e. g. "Replace" or "Append input".

To cut, copy, paste and delete elements, you can use the usual commands of the Edit menu. Copying also works with drag and drop while the [Ctrl] key is pressed.

FBD/LD/IL Editor 4:

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

Selecting elements:

You can select a function block or connecting line in the editor by clicking on it, so that the focus is on it. Multiple selection is possible while the button [Ctrl] is pressed. A selected element is shaded in red.

Tooltip:

When the cursor points to specific elements, such as a variable or an input, a tooltip appears with information about that element.

For elements with a squiggly red line, the tooltip shows the corresponding precompile error message.

Navigating in the editor:

Using the buttons and commands described below, you can move the focus to a different cursor position within the editor. Switching between positions also works across networks.

[←] [→]

Change to the adjacent 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 adjacent position belongs to the same logical group. A logical group is formed by all the connections of a function block, for example.

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

[Ctrl] + [Pos 1]

Change to the first network; this is selected.

[Ctrl] + [End]

Change to the last network; this is selected.

[Image up]

Scroll up 1 page. The top network on this page is selected.

[Image down]

Scroll down 1 page. The bottom network on this page is selected.

Command "Go To..."

Change to a specific network.

Opening a function block:

If a function block is inserted in the editor, you can double-click its implementation by double-clicking or by using the command Go To of the context menu.

See also:

IL-Editor

Inserting and arranging items:

You can insert elements by using the commands of the menu FBD/LD/IL or the context menu. A new network can also be added from the Toolbox into the implementation part of the editor with drag & drop.

To cut, copy, paste and delete elements, you can use the usual commands of the Edit menu. Copying also works with drag and drop while the [Ctrl] key is pressed.

FBD/LD/IL Editor 5:

Note that operators with EN/ENO functionality can only be inserted in the FBD and LD editor.

Each program line is entered in a table row.

Structure of a network in the IL editor:

Line 1: Network title

Requirement: The option is activated in the TwinCAT options

Line 2: Network comment

Requirement: The option is activated in the TwinCAT options

from line 3:

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 also specify the corresponding parameters here; in this case, you must enter := or => in the preceding field.

2

Operand

Contains precisely one operand or the name of a label.

If there are several operands, you must enter them in several lines and insert a comma directly behind the individual operands. (See example below)

3

Address

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

not editable

You can enable/disable the display using the Show symbol address option. To do this, select the command Tools > Options and in the category TwinCAT > PLC Environment > FBD, LD and IL select the General tab.

4

Symbol comment

Contains any comment that may have been entered for the operand in the declaration.

not editable

You can enable/disable the display using the option Show symbol comment by selecting the command Tools > Options and selecting the General tab in the category TwinCAT > PLC Environment > FBD, LD and IL.

5

Operand comment

Comment relating to the current program line.

You can enable/disable the display using the option Show operand comment by selecting the command Tools > Options and selecting the General tab in the category TwinCAT > PLC Environment > FBD, LD and IL.

Example:

FBD/LD/IL Editor 6:

Navigating in the editor:

Key(s)/command

Cursor movement

[↑][↓]

Jump to the field above/below.

[Tab]

Jump right to the next field within the line.

[Shift] + [Tab]

Jump left to the preceding field within the line

[Space]

Opens the edit frame for the selected field. Alternatively, you can click on the field with the mouse. If applicable, the button for the Input Assistant dialog is available.

[Ctrl] + [Enter]

Inserts a new line below the current line.

[Del]

Deletes the current line.

[Ctrl] + [Pos 1]

Sets the focus to the beginning of the document and marks the first network.

[Ctrl] + [End]

Moves the focus to the end of the document and marks the last network.

[Image down]

Scrolls up a page and marks the topmost rectangle.

[Image up]

Scrolls down a page and marks the topmost rectangle.

See also: