Declare Functions or Function Blocks

This section explains how to create a new function or UDFB.

  1. Expand the PLC node in the Project Explorer, and right-click on the Subprograms item and select the action you wish to perform (i.e., New Function or New UDFB). The New Program dialog box will open.
  2. Enter the program name (MyFBD, for example), and click OK.
  3. The Program Properties dialog box opens. This is where you will enter the input and output parameters for the function or UDFB.
  4. Click in the editable space ("…") in Inputs or Outputs enables the Edit button.
    Click the Edit button or double-clicking on the editable space opens the Parameters dialog which lets you add variables for Inputs and Outputs.

Item

Description

Edit

Click this button to change the definition of the selected parameter.

When the last line (...) of the list is selected, click this button to a new parameter.

Delete

Click this button to remove the selected parameter.

Move Up/Down

Click these buttons to move the selected parameter in the list to arrange the order of parameters. The order is very important as it defines the calling prototype of the UDFB or sub-program.

Swap

Click this button to move the selected parameter between the Inputs and Outputs lists.

When an button is selected the button's text changes to show where the parameter is moved.