Introduction
You have different options for using data in your ST section.
Using already declared variables
You can use a data selection dialog box.
or
you can enter the variable name just like any other text.
Use undeclared variables and declare them later
You can define the variable name when creating your ST section and then declare all variables used.
Use undeclared variables and declare them immediately
You can define variable names when creating your ST section and declare them immediately.
Declaration of variables directly in the ST section.
You can declare variables in the Data Editor, but also directly in the ST section.
Using formal parameters from function blocks (inputs/outputs, public variables)
You can use a data selection dialog box.
or
You can enter the formal parameter name just like any other text.
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:
Result: A data selection box is opened. ![]() |
4 |
You have the following options to enter variables:
Example of a variable selection dialog box: ![]() Result: The selected variable is enabled in the section. |
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 ST 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 in the shortcut menu, or press the Shift+Enter key combinationResult: 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 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 ![]() |
6 |
Confirm with Enter or the Result: The variable is declared and inserted at the target position in the section. |
Declaration of variables directly in the ST section.
Process the following steps to declare variables directly in the ST section.
Step |
Action |
---|---|
1 |
Place the cursor in an undeclared variable (undeclared variables are identified by a red wavy line). |
2 |
Click in the shortcut menu, or press the Shift+Enter key combinationResult: The variable declaration dialog box opens. ![]() Note: The variable name automatically appears in the 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 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 ![]() |
5 |
Confirm with Enter or the 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:
Result: A data selection box is opened. ![]() |
4 |
You have the following options to enter the formal parameter:
|
5 |
Select the 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: All available formal parameters are displayed now. ![]() |
7 |
Select the desired formal parameter and confirm with .Result: The selected formal parameter is inserted into the section and a syntax and semantics check is performed. For example: |