Programming Function Block Diagrams (FBD)

Creating a POU in the Function Block Diagram implementation language (FBD)

1. Select a folder in the Solution Explorer in the PLC project tree.
2. In the context menu select the command Add > POU...
The Add POU dialog opens.
3. Enter a name and select the implementation language "Function Block Diagram (FBD)".
4. Click on Open.
The POU is added to the PLC project tree and opened in the editor. It consists of the declaration editor in the upper part and the implementation part with an empty network in the lower part. The Toolbox view opens automatically, providing suitable elements, operators and function blocks for FBD programming.

Programming a network

1. Click in the automatically added empty network in the implementation part.
The network is highlighted in yellow, the part with the network number on the left edge is highlighted in red.
2. Right-click to open the context menu.
It provides add commands for elements that can be added at this point.
3. Add the required programming elements via the menu commands or by dragging the elements from the Toolbox view.
4. Select the command Insert Assignment, for example.
An assignment line is added. Three question marks represent the assignment source and the assignment target.
5. Select the question marks and replace them with the required variable. The input assistant is available.
6. Move the cursor over the assignment line.
The possible insert positions for further elements are shown as grey hash characters. Click on a hash character to select the position. Once again, the suitable insert instructions become available.
7. Alternatively, you can use the mouse to drag an element from the Toolbox view into the network. For example, in the Toolbox view click on the function block element, keep the mouse button pressed and move the cursor over the network.
All possible insert positions are shown in green.
8. Release the mouse button to insert the function block.
The function block is shown in the network. The internal function block type and the instance name above the box, which is required if a function block is used, are still indicated by three question marks.
9. Select the three question marks within the box and replace them with the function block name. The input assistant is available.
The inputs and outputs of the selected function block are shown. They are still indicated by question marks, for function blocks also the instance name.

See also:

Programming branches (subnetworks)

1. Add a new network in the implementation part of your POU via the command Insert Network in the FBD/LD/IL menu or from the context menu or from the Toolbox view.
2. For example, drag an ADD operator into the empty network and replace the three question marks with two variables of data type INT.
3. Drag the element Branch from the Toolbox view into your implementation and release the mouse button at the green insert position directly at the output of the operator.
The line branch splits the processing line at the output of the operator box into two subnetworks. Further FBD elements or line branches can be added to each of the two subnetworks.

See also: