Declaration of symbolic names for constants - STEP 7

Programming basics

ft:publication_title
Programming basics
Product
STEP 7
Version
V21
Publication date
11/2025
Language
en-US
Declaration of symbolic names for constants

Symbolic constants

You have the option of declaring symbolic names for constants and thus making constant values available under a name in the program. This makes a program more readable and easier to maintain when changing constant values.

A symbolic constant consists of the following elements:

  • Name

  • Data type

    Symbolic constants always have a data type; non-typed notation is not possible for symbolic constants.

  • Constant value

    You can select any value from the value range of the specified data type as constant value. For information on the value ranges, refer to the "Data types" chapter.

Declaration of constants

You can define constants with different scopes of validity:

  • Global constants that apply to all areas of the CPU

  • Local constants that only apply within a block

The table below shows the difference between the constant types:

Global constants

Local constants

Scope of validity

  • Are valid throughout the entire CPU

  • The name is unique within the CPU.

  • Are valid only in the block in which they were declared.

  • The name is unique within the block.

Permitted characters

  • The permitted characters in constant names are letters, digits and special characters.

  • The permitted characters in constant names are letters, digits and special characters.

Location of definition

"Constants" tab from the PLC tag table

Block interface

Representation

In quotation marks, for example.:

"Glob_Const"

Prefixed with a number sign, for example:

#Loc_Const

Name conflicts can occur if you have declared a local and a global constant with the same symbolic name and have used this doubly specified name as the default value of a tag. In this case, the local constant is automatically used.

Note

Downloading constant declarations (S7-300/400)

Local and global constant declarations are not downloaded into the CPU. If you download a program from a device, the constant declarations may no longer be available.

Note

You can find more information on permissible characters in constant names in the Siemens Industry Online Support in the following entries:

When should identifiers and operands be used in "quotation marks" in STEP 7 (TIA Portal)?

https://support.industry.siemens.com/cs/ww/en/view/109477857