Introduction

You have different options for using data in your IL section.

Entering declared variables using data selection

Carry out the following steps to enter a declared variable using data selection:

Step

Action

1

Declare the required variables, see also Creation of EDT instances.

2

Place the cursor at the target position.

3

Open data selection by:

  • The Edit > Data Selection menu command..

  • The Data Selection... menu command from the shortcut menu for the section.

    or

  • Press the Ctrl+D key combination.

Result:

A data selection box is opened.

4

You have the following options to enter variables:

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

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

  • You can delete your entry by pressing Esc or the button .

  • Use the button ...to open a variable selection dialog box and in the Variables tab confirm the selected variable using the OK button.

Example of a data selection dialog box:

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

Entering undeclared variables and declaring them later

Process the following steps to enter undeclared variables and declare them later:

Step

Action

1

Place the cursor at the target position.

2

Enter the variable name.

Result: The variable selected is accepted. The syntax and semantics check marks the variable name with a red wavy line to identify it as being undeclared, e.g.

3

Enter all variables in this way.

4

Declare all variables in the Data Editor or directly in the IL section.

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

Entering undeclared variables and declaring them immediately

Process the following steps to enter undeclared variables and declare them immediately:

Step

Action

1

Place the cursor at the target position.

2

Click Create Variable in the shortcut menu, or press the Shift+Enter key combination

Result: The variable declaration dialog box opens.

3

Enter the variable name and data type.

4

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

Result: The variable is declared and inserted at the target position in the section.

5

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.

6

Confirm with Enter or the symbol.

Result: The variable is declared and inserted at the target position in the section.

Declaration of variables directly in the IL section.

Process the following steps to declare variables directly in the IL section.

Step

Action

1

Place the cursor in an undeclared variable (undeclared variables are identified by a red wavy line).

2

Click Create Variable in the shortcut menu, or press the Shift+Enter key combination

Result: The variable declaration dialog box opens.

Note: The variable name automatically appears in the Name field, if editor recognizes the text entered in the section as a variable and its syntax is correct.

3

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.

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 the red wavy line under the variable name disappears.

Using formal parameters

Process the following steps to use formal parameters with data selection:

Step

Action

1

Call the function block whose formal parameters you want to use, see also Calling a function block.

2

To use the formal parameter, place the cursor at the target position.

3

Open data selection by:

  • The Edit > Data Selection menu command..

  • The Data Selection... menu command from the shortcut menu for the section.

    or

  • Press the Ctrl+D key combination.

Result:

A data selection box is opened.

4

You have the following options to enter the formal parameter:

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

    In this case the procedure ends here.

  • You can select the name from the list of recently used names using the symbol and confirm using Enter or the button.

    In this case the procedure ends here.

    or

  • Use the button ... to open a data selection dialog box.

5

Select the Function Blocks tab.

Result:

All declared block instances are displayed.

6

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

Result:

You can now see all available inputs/outputs of the function block.

7

Select the desired formal parameter and confirm with OK.

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

For example: