How do you define the constants in an S7-SCL program in STEP 7 (TIA Portal)?
In STEP 7 V5.x you can define the local constants in the declaration part of the SCL block code and use them in the program as shown in Fig. 1.
In STEP 7 (TIA Portal) it is not possible to define constants in the declaration part CONST/END_CONST of the SCL program code.
This is how you define the constants in STEP 7 (TIA Portal) V13 and higher:
- You define the local user constants in the block interface of an FC/FB under "Constant" and you can then use them in the block program. Here you must define a data type for the use constants.
- You define the global user constants, which are to be available CPU-wide, in the PLC tags in the "User constants" tab. Also when defining the global user constants you must define the data type.
Only use local constants within a block. In this way the block remains universal and can be used in a library.
More information is available using the links in the following table:
The screens in this FAQ response were created with STEP 7 (TIA Portal) V15.0 and STEP 7 V5.6.