Introduction

Inputs and outputs are required to transfer values to or from an FFB. These are called formal parameters.

Objects are linked to formal parameters; these objects contain the current process states. They are called actual parameters.

The data type of the actual parameter must match the data type of the input/output (formal parameter). The only exceptions are generic inputs/outputs whose data type is determined by the actual parameter. If all actual parameters consist of literals, a suitable data type is selected for the function block.

Formal and Actual Parameters:

Permitted actual parameters are:

NOTE: Please take note of the section Information about Programming in the Reference manual.

You can make actual parameter assignments for

Assign declared variables to a pin

Process the following steps to assign undeclared variables to a pin. (See also Creation of EDT instances.)

Step

Action

1

Open a data selection box for the desired FFB pin by:

  • double-clicking the pin.

  • selecting the pin and clicking the Edit > Data Selection... menu command.

  • selecting the pin and clicking the Data Selection menu command on the shortcut menu.

  • selecting the pin and pressing the Ctrl+D key combination.

    or

  • selecting the pin and clicking the symbol.

Result:

The data selection box opens.

2

You have the following options to enter variables:

  • You can now enter the variable name and confirm using Enteror the button.

  • You can select the variable names from the list of recently used names using the symbol and confirm using Enteror the button.

  • You can delete your entry by pressing Escor clicking the button.

  • Using the button ... open an Instance selection dialog box and confirm the selected variables there with OK .

Example of a instance selection dialog box:

Result: The selected variable is inserted and a syntax and semantics check is performed.

Example:

Assign undeclared variables to a pin

Process the following steps to assign undeclared variables to a pin:

Step

Action

1

Open a data selection box for the desired FFB pin by:

  • double-clicking the pin.

  • selecting the pin and clicking the Edit > Data Selection... menu command.

  • selecting the pin and clicking the Data Selection menu command on the shortcut menu.

  • selecting the pin and pressing the Ctrl+D key combination.

    or

  • selecting the pin and clicking the symbol.

Result:

2

Enter the variable name and confirm using Enteror the symbol.

Result: The variable declaration dialog box opens.

3

Change the default data type, if desired.

Note: If you wish to declare the variable later, close the dialog box using the symbol. In this case, the variable name is enabled on the pin, but not declared.

4

If you do want to assign the variable an address and/or comment, use the symbol for obtaining an advanced dialog and enter the address and/or comment.

5

Confirm with Enter or the symbol.

Result:The variable is declared and enabled on the selected pin.

6

Enter all actual parameters in this way.

Declaring variables on a pin

Process the following steps to declare variables on a pin:

Step

Action

1

Open the variable declaration dialog box for the desired variable by.

  • Select an undeclared variable (red wavy line under the variable name) and the Create Variable command from the shortcut menu.

  • Select an undeclared variable (red wavy line under the variable name) and the Shift+Enter key combination.

Result: The variable declaration dialog box opens.

2

If you do not want to assign an address or comment, confirm using Enter or the symbol.

Result: The variable is declared and the red wavy line under the variable name disappears.

3

If you do want to assign the variable an address and/or comment, use the symbol for obtaining an advanced dialog and enter the address and/or comment.

4

Confirm with Enter or the symbol.

Result: The variable is declared and the red wavy line under the variable name disappears.

Assigning formal parameters to a pin

Process the following steps to assign formal parameters to a pin:

Step

Action

1

Select the desired FFB pin.

2

Open a data selection box by:

  • double-clicking the pin.

  • selecting the pin and clicking the Edit > Data Selection menu command.

  • selecting the pin and clicking the Data Selection menu command on the shortcut menu.

  • selecting the pin and pressing the Ctrl+D key combination.

    or

  • selecting the pin and clicking the symbol.

Result:

The data selection box opens.

3

You have the following options to enter the formal parameter:

  • You can enter the formal parameter name and confirm using Enter or the button.

  • You can select the formal parameter name from the list of recently used names using the symbol and confirm using Enteror the button.

  • You can delete your entry by pressing Escor clicking the button.

  • Using the button ... to open an Instance selection dialog box.

4

Select the Function Block tab.

Result:

The function block instances are displayed.

5

Expand the display of the inputs, outputs and public variables by clicking their + symbols.

Result:

You can now see all available inputs, outputs and public variables of the function block.

6

Select the desired formal parameter and confirm with OK.

7

Result: The formal parameter selected is inserted and a syntax and semantics check is performed.

Example:

Assigning literals to a pin

Process the following steps to assign literals to a pin:

Step

Action

1

Select the desired FFB pin.

2

Open a data selection box by:

  • double-clicking the pin.

  • selecting the pin and clicking the Edit > Data Selection menu command.

  • selecting the pin and clicking the Data Selection menu command on the shortcut menu.

  • selecting the pin and pressing the Ctrl+D key combination.

    or

  • selecting the pin and clicking the symbol.

Result:

The data selection box opens.

3

Enter the literal (e.g. 0, 1, TRUE, FALSE, 1.0, 3.5, t#2ms) and confirm using the Enterbutton.

Tips:When in the Tools > Project Settings dialog box, on the Language extensions tab, the Allow leading digits checkbox is cleared, the following simplifications for entering literals are possible:

  • When assigning TIME literals to a pin of the TIME data type, it suffices to enter the numerical value and the unit (such as h, m, s). The prefix (t#) is automatically added.

  • When assigning REAL literals to a pin of the REAL data type, for integers it suffices to enter the numerical value. The decimal marker (t#) is automatically added.

Result: The literal is inserted and a syntax and semantics check is performed.

Example:

Assigning ST expressions to a pin

Process the following steps to assign ST expressions to a pin:

Step

Action

1

Make sure that the Usage of ST expressions checkbox is activated in the Tools > Project Settings dialog box.

2

Select the desired FFB pin.

3

Open a data selection box by:

  • double-clicking the pin.

  • selecting the pin and clicking the Edit > Data Selection menu command.

  • selecting the pin and clicking the Data Selection menu command on the shortcut menu.

  • selecting the pin and pressing the Ctrl+D key combination.

    or

  • selecting the pin and clicking the symbol.

Result:

The data selection box opens.

4

Enter the ST expression (e.g. MUX(1,var1,var2), VarA * VarB, VarA < VarB) and confirm pressing Enter.

Result: The ST expression selected is inserted and a syntax and semantics check is performed.

Example:

If the variables have already been declared (see also Creation of EDT instances), the procedure ends here.

If the variables have not yet been declared, continue with step 5.

5

Declare all variables used, either:

  • using the data editor

    or

  • using Create variable in the context menu (possible when only one variable of the ST statement is undeclared).

Actual parameter assignment using the function input assistant

Process the following steps to change actual parameter assignment with the function input assistant:

Step

Action

1

Select the desired FFB.

2

Open the function input assistant:

  • The Edit > FFB Input Assistant... menu command.

  • The FFB Input Assistant... menu command from the shortcut menu.

    or

  • The Ctrl+I key combination.

Result:

The function input assistant will be opened.

3

Double click the Entry Field cell of the first formal parameter and enter the actual parameter to be used.

You have the following options to enter the variables/addresses:

  • You can enter the variable name and confirm using Enter.

  • You can select the variable/address from the list of recently used variables/addresses using the symbol.

    or

  • Using the buton ... to open an Instance selection dialog box.

Assign an actual parameter to all formal parameters of the function block in this way.

Example:

4

Confirm the entries using the OK button.

Result: The actual parameter is inserted and a syntax and semantics check is performed.

Example: