Skip to main content

Element: Box

Symbol: cfc_icon_element_box.png

. Keyboard shortcuts for inserting the element
  • Ctrl + B

  • Ctrl + Shift + B: Empty box

  • Ctrl + Shift + E: Box with EN/ENO

If you want to insert an operator, function, function block, or program into your code, then drag an element into the editor area. The element is inserted by default with the name ???. You can edit this field directly by clicking it and typing in a function block name. Alternatively, you could also click the _cds_icon_three_dots.png button to open the Input Assistant and select a function block.

In the case of a function block, an input field ??? is also displayed above the function block symbol. You need to replace these three questions marks with the name of the function block instance. If you instantiate a function block with constant input parameters, then the box element shows the Parameter field in the bottom left corner. You click this field to edit the parameters. Alternatively, you could also use the Edit Parameters command.

To replace an existing box, you replace only the currently inserted identifier with the new desired name.

Tip

When you do this, note that the number of input and output pins is automatically adapted according to the definition of the POU. As a result, any existing assignments will be deleted.

Feedback of connections

Because feedback is allowed in CFC, implicit variables with the data type of the input variable are created at the output of a box. If the result of the operation of a function block is a value which exceeds the number range of the data type of the input variable, then the overflow is written to this implicit variable. The actual output variable gets the value of the implicit variable, thus the overflow and not the actual result of the operation.

Example 6. Example

Implicitly generated variables temp_USINT at the output pin:

cfc_img_box_impl_variable.png

Implicitly generated code:

temp_USINT := USINT1 * temp_USINT;
UDINT1 := temp_USINT;