Technical data
Creating STL Source Files
13.2 Rules for Programming in STL Source Files
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 281
13.2.2 Rules for Declaring Variables in STL Source Files
For every block in the source file you must declare the required variables.
The variable declaration section comes before the code section of the block.
The variables must - if they are being used - be declared in the correct sequence for declaration
types. This means all variables of one declaration type are together.
For Ladder, Function Block Diagram, and Statement List you fill out a variable declaration table, but
here you have to work with the relevant keywords.
Keywords for Variable Declaration
Declaration Type Keywords Valid for...
Input parameters "VAR_INPUT"
Declaration list
"END_VAR"
FBs, FCs
Output parameters "VAR_OUTPUT"
Declaration list
"END_VAR"
FBs, FCs
In/out parameters "VAR_IN_OUT"
Declaration list
"END_VAR"
FBs, FCs
Static variables "VAR"
Declaration list
"END_VAR"
FBs
Temporary variables "VAR_TEMP"
Declaration list
END_VAR
OBs, FBs, FCs
The keyword END_VAR denotes the end of a declaration list.
The declaration list is a list of the variables of a declaration type in which default values can be
assigned to the variables (exception: VAR_TEMP). The following example shows the structure of
an entry in the declaration list:
Duration_Motor1 : S5TIME := S5T#1H_30M ;
Variable Data type Default value
Note
The variable symbol must start with a letter. You may not assign a symbolic name for a variable that is the same
as one of the reserved keywords.
If variable symbols are identical in the local declarations and in the symbol table, you can code local variables by
placing # in front of the name and putting variables in the symbol table in quotation marks. Otherwise, the block
interprets the variable as a local variable.