PRO1 05E Symbols
PRO1 05E Symbols
PRO1 05E Symbols
Contents Page
Objectives ........................................................................................................................................ 2
Absolute and Symbolic Addressing .................................................................................................. 3
Symbolic Addressing ......................................................................................................................... 4
The Symbol Table ............................................................................................................................ 5
Edit: Find and Replace .................................................................................................................... 6
View: Filter ...................................................................................................................................... 7
View: Sort ........................................................................................................................................ 8
Editing Symbols in the LAD/STL/FBD Editor ..................................................................................... 9
Symbol Information in the LAD/STL/FBD Editor ................................................................................ 10
Symbol Selection in the LAD/STL/FBD Editor ................................................................................... 11
Symbol Table: Export ....................................................................................................................... 12
Symbol Table: Import ....................................................................................................................... 13
Exercise 1: Importing a Symbol Table .............................................................................................. 14
Leading Symbols .............................................................................................................................. 15
A I0.0 A "SYSTEM_ON"
= Q8.0 = "SYSTEM_ON"
A I0.4 A "M_FORW"
= Q20.5 = "MOTOR_FOR"
Call FC18 Call "COUNT"
Absolute In absolute addressing, you specify the address (such as input I 1.0) directly. In
Addressing this case you don‘t need a symbol table, but the program is harder to read.
Symbolic In symbolic addressing, you use symbols (such as MOTOR_ON) instead of the
Addressing absolute addresses.
You store the symbols for inputs, outputs, timers, counters, bit memories and blocks in
the symbol table.
Note When you enter symbol names, you don‘t have to include quotation marks. The
Program Editor adds these for you.
Where are symbols used? Where are they stored? With what are they created?
Global Symbols Global symbols are declared in the symbol table and can be used in all blocks of a
program.
The name in the symbol table must be unique, that is, a symbolic name must appear
only once in the table.
Local Symbols Local symbols are declared in the declaration part of a block. They can be used only
within that block.
The same symbolic name can be used again in the declaration part of another block.
Notes The LAD/STL/FBD Editor always displays symbols declared in the global symbol table
in quotation marks. Local address symbols (local variables and parameters) are always
displayed with a # (hash or pound mark).
You don‘t have to include the quotation marks or the hash mark when you enter
symbolic addresses. The program editor automatically adds these for you.
Double-click
Opening the Every "S7 program" has its own symbol table. You can open a symbol table
Symbol Table from the SIMATIC® Manager with a double-click on the "Symbols" icon.
You can also open the symbol table from the LAD/STL/FBD Editor using the Options ->
Symbol Table menu option.
Table Structure In the symbol table, a line is created for every variable. You can then enter the symbol
name, the address, the data type and a comment for the variable in the columns. A
blank line is automatically added at the end of the table for defining a new symbol.
"Status" Column Invalid symbol definitions are marked as follows in this column:
= The symbol name or address is identical to another entry in the symbol table.
x The symbol is incomplete (the symbol name and/or the address is missing).
Note As soon as a symbol table has been created, it is available to all other tools (such as
LAD/STL/FBD Editor, HW-Config, and Monitor/Modify Variables).
The "Flag" symbol in the first column indicates that the address has a particular
attribute. You have attributes, for example,
- with the direct control of an address
- reference to use as communications variable
- reference to use as message variable etc.
Please don‘t use any special characters in the symbol names.
Find and Replace A number of options are available for finding and replacing text in the current window:
• Find what:
Enter the text you are looking for.
• Replace with:
Enter the replacement text.
• From cursor down:
Searches downwards to the last line in the symbol table.
• From cursor up:
Searches upwards to the first line in the symbol table.
• Match case:
Only searches for the specified text with identical use of uppercase and
lowercase letters.
• Find whole words only:
Searches for the specified text as a separate word, not as part of a longer
word.
• All:
Searches through the whole symbol table, starting from the cursor position.
• Selection:
Searches only the selected symbol lines.
Note When looking for addresses, you must insert a wildcard after the address identifier,
otherwise the address cannot be found. There are two wildcards that can be used:
• Asterisk (*) for no character, or one or more unspecified characters;
• Question mark (?) for one unspecified character.
Example: replace all outputs with address 8. with address 4.:
Find what: Replace with:
Q*8.* Q 4.
View: Filter Only the symbols which meet the active filter criteria ("symbol properties") are
displayed in the current window.
You can apply several criteria at once. The following filter criteria can be linked with one
another:
Name, Address, Data Type, Comment, Operator Control & Monitoring, Communication,
Message and Monitoring.
Permissible wildcards are * for several characters and ? for one character.
Examples • Name: M*
Only the names that begin with "M" and that contain any number of additional
characters are displayed in the symbol table.
• Name: SENSOR_?
Only the names that begin with "SENSOR_" and that contain one other character are
displayed in the symbol table.
• Address: I*.*
Only the inputs are displayed.
• Valid, Invalid
The symbols must be unique, that is, a symbol or an address must exist only once in
the symbol table.
If a symbol or an address appears more than once, the lines in which it appears are
displayed in "Bold". If your symbol table is long, and you want to find such ambiguous
symbols or addresses more quickly, you can display only these lines of the symbol
table by selecting the menu option View Filter and the attribute "Invalid".
Sort The entries in the symbol table can be displayed in alphabetical order. You use the
View Sort menu option to specify the column to be used as the point of reference for
sorting in the current window.
There is an alternative way to sort:
1. Click the column heading "Symbol, Address, Data type or Comment" for
sorting in ascending order in this column. Answer "Yes" when prompted.
2. Click the column heading once more for sorting in descending order in this
column. Answer "Yes" when prompted.
Edit Symbols Edit Symbols enables you to assign symbolic names to absolute addresses at a later
time. These assigned names are automatically entered into the symbol table.
What to do There are two ways to get to the “Edit Symbols“ from the LAD,STL,FBD editor:
highlight an address field and choose Edit Symbols… or
right mouse click the address field and select Edit Symbols...
Enter the Symbol name, Data Type and Comment you want to assign to that address
and then OK.
Note If you assign a name that is already in the symbol table, it will be displayed in a different
color. Duplicate names cannot be used in the symbol table.
Addressing In the LAD/STL/FBD Editor you can choose to display the addresses in one of the
following two ways when you select the View Display with Symbolic
Representation menu option:
• Symbolic Addressing or
• Absolute Addressing.
You can display the symbolic and absolute address assignments used in the network
along with their comments by selecting the View Display with Symbol Information
menu option.
The assignments are found under the network in LAD/FBD and in STL they are found in
the statement line.
Symbol Information In the LAD/STL/FBD Editor settings you can select whether the symbol information for
the addresses is to be displayed directly at the address (see right picture) or at the
lower edge of the network (see left picture).
Note If you position the mouse pointer on an address, a "Tooltip" appears with the symbol
information for this address.
Introduction You can use the View Display with Symbol Selection menu option to simplify
writing a symbolic program.
When you label the adddress and you enter the first letter of a symbol name, a section
of the symbol table pops up that starts with this letter.
All valid addresses for this block are displayed. These can be all global variables (even
those declared in data blocks), local variables (temporary and static) and the
parameters of the affected block.
General The Symbol Table Export menu option enables you to store symbol tables in
different file formats so that you can work on them with other programs. You can select
the following file formats:
• ASCII Format (*.ASC)
- Notepad
- Word
• Data Interchange Format (*.DIF)
- EXCEL
• System Data Format (*.SDF)
- ACCESS
• Assignment List (*.SEQ)
- STEP 5 assignment list
General The Symbol Table Import menu option enables you to import symbol tables that
were created with other user programs.
Task You are to import a prepared system table, that has, for example, been created in a
spread-sheet program (Excel), into your S7 project called "My_Project".
What to Do 1. In the SIMATIC Manager, open your S7 project called "My_Project" and show all
hierarchal levels (menu option View Expand all)
2. Start the Symbol Editor by double-clicking on the symbol table
3. After selecting the menu option Table Import, set the directory path (for
example, D:\S7-Courses\PRO1\Symbols), the file name and the file fomat in the
dialog box (see picture) and import the completed symbol table.
Address Priority:
Absolute Value
Address Priority:
Symbols
Symbol Table
Old Entry:
L_SYSTEM = Q8.0
New Entry:
L_SYSTEM = Q4.1
Introduction If you want to change the assignments in the symbol table of an already existing
program, you can also decide whether the absolute address or the symbolic address
has priority.
Selection In the SIMATIC® Manager, right mouse click the "Blocks" object of an S7 program.
Select the Object Properties menu option and then the "Blocks" tab.
You can choose between "Absolute Value" or "Symbol" in the "Address priority" field.
Address Priority: With this setting, the absolute address of an operand does not change if you
Absolute Value change the address assignment in the symbol table later on.
In the example above, the output Q8.0 (symbol name "L_SYSTEM") was changed to
output Q4.1 in the symbol table. With the "Address Priority: Absolute Value" setting, the
program continues to use the output Q8.0.
Address Priority: With this setting, the absolute address of the operand is changed to the
Symbol new entry in the symbol table (functionality: “Rewire with Address Priority: Symbol“).
In the example above, the output Q8.0 (symbol name "L_SYSTEM") was changed to
output Q4.1 in the symbol table. With the "Address Priority: Symbols" setting, the
address is changed from Q8.0 to Q4.1 throughout the entire program.
For this, the block with the changed address must be opened or the "Check Block
Consistency" function must be used.
The changed address also keeps its symbol name. That way you can change the
absolute addresses in an existing symbolic user program.