×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 52258437, Entry date: 12/28/2015
(9)
Rate

How do you define the constants in an S7-SCL program in STEP 7 (TIA Portal)?

  • Entry
  • Associated product(s)
In Step 7 V5.x you can only define local constants in the declaration part of the SCL block code and use it in the program. Contrarily, STEP 7 (TIA Portal) differentiates between local and global user constants that you can define in the block interface or in the PLC tags.

Description
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.
 


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.
     

    Fig. 2 
  • 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.
     

    Fig. 3
     
Note 
Only use local constants within a block. In this way the block remains universal and can be used in a library.

Creation Environment
The screens in this FAQ response were created with STEP 7 (TIA Portal) V15.0 and STEP 7 V5.6.

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration.