Skip to main content

Changing of constant input parameters of function block instances

You can write input parameters of function block instances of type VAR_INPUT CONSTANT in online mode and modify the parameters in this way. After logging out, you save these parameters by clicking Save Prepared Parameters to Project.

Requirement: A CFC editor is active. An instantiated function block has VAR_INPUT CONSTANT variables in its declaration.

  1. In the editor, open the box by calling the function block instance.

    The declaration of FB_DoIt has been supplemented by the constant MAXIMUM.

    FUNCTION_BLOCK FB_DoIt
    VAR_INPUT     
        iAlfa : INT;     
        iBravo: INT;     
        sCharlie : STRING := 'Charlie';     
        xItem : BOOL;     
        iDelta : INT;
    END_VAR
    VAR_INPUT CONSTANT     
        MAXIMUM : INT := 12;
    END_VAR
    VAR_OUTPUT     
        iResult : INT;     
        sResult : STRING;     
        xResult : BOOL;
    END_VAR
    cfc_img_in_online_mode_with_var_constant.png

    The graphical representation of the function block instances contains the Parameters button.

  2. Log in to the controller.

  3. Click the Parameters button of the function block instance.

    The Edit Parameters dialog opens.

  4. Click the Value column in an inline monitoring field of a parameter.

    The Prepare Value dialog opens.

  5. Type 20 in the Prepare a new value for the next write or force operation field.

  6. Click OK to confirm the entry.

    The prepared value is shown in angle brackets next to the current value. Example: <20>

    cfc_img_edit_parameter_prepare.png
  7. Click Debug → Write Value.

    The prepared value is written. The parameter is changed and displayed in the project in brackets after the value.

    cfc_img_edit_parameter_write.png

    The difference between both values is shown by a red asterisk next to the parameter field of the function block instance.

    cfc_img_pou_parameter_changed.png
  8. Click Edit Parameters to close the dialog. Log out.

  9. Click CFC → Save Prepared Parameters to Project.

    The change parameter value is saved to the project. The asterisk next to the parameter field disappears.