Вы находитесь на странице: 1из 14

Symbolic Addressing

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.1

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 LAD/FBD .................................................................................................... 11
Symbol Table: Export .................................................................................................................. 12
Symbol Table: Import .................................................................................................................. 13
Exercise 1: Importing a Symbol Table …………………………..................................................... 14

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 1 Symbolic Addressing
Objectives

Upon completion of the chapter the participant will ...

... know the difference between absolute and symbolic addressing

... know the difference between local and global symbols

... know the difference betweeen leading symbols and leading


absolute addresses

... be able to edit a global symbol table

... be able to use the Block Editor to edit global symbols

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.2

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 2 Symbolic Addressing
Absolute and Symbolic Addressing

Absolute Representation Symbolic Representation

A I0.0 A "SYSTEM_ON"
= Q8.0 = "LED_ON"
A I0.4 A "M_FORW"
= Q20.5 = "MOTOR_FOR"
Call FC18 Call "COUNT"

Symbol Address Data Type Comment


MOTOR_FOR Q20.5 BOOL Motor moves forward
COUNT FC18 FC18 Count bottles
SYSTEM_ON I0.0 BOOL Switch system on
SYSTEM_ON Q8.0 BOOL Indicator: System is “On”
M_FORW I0.4 BOOL Pushbutton: Motor forward

(max. 24 characters) (max. 80 characters)

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.3

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.

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 3 Symbolic Addressing
Symbolic Addressing

Where are symbols used? Where are they stored? With what are they created?

Global Data: Symbol Table Symbol Editor


- Inputs
- Outputs
- Bit mem., timers, counters
- Peripheral I/O

Local Block Data: Declaration part of the Program Editor


- Block parameters block
- local / temporary data

Jump Labels Code section of the Program Editor


block
Block Names: Symbol Table Symbol Editor
- OB
- FB
- FC
- DB
- VAT
- UDT

DB Components Declaration part of the DB Program Editor

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.4

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) in front of
them.
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.

Abbreviations - OB Organization blocks (administration blocks)


- FC Functions (are used for program structuring)
- FB Function blocks (instantiation)
- DB Data blocks (store process data in the S7)
- VAT Variable tables (monitoring instrument for process variables)
- UDT User-defined data types (data type defined by the user)

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 4 Symbolic Addressing
The Symbol Table

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.5

Opening the Every "S7 program" has its own symbol table. You can open a symbol table
Symbol Table from the SIMATIC Manager, among other ways, 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 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, the declared symbols are also
available in all other tools (such as LAD/STL/FBD Editor, HW-Config, and
Monitor/Modify Variables etc.).

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 5 Symbolic Addressing
Edit: Find and Replace

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.6

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 (? for one character, * for several characters), otherwise the address
cannot be found.
Example: For find and replace:
for example, replace all outputs that have address 8. with address 4.:

Find what: Replace with:


Q 8. Q 4.

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 6 Symbolic Addressing
View: Filter

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.7

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.
Permissible wildcards are ? for one character and * for several characters.

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

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 7 Symbolic Addressing
View: Sort

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.8

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.

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 8 Symbolic Addressing
Editing Symbols in the LAD/STL/FBD Editor

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.9

Edit Symbols With the menu option Edit Æ Symbols..., or a right mouse-click on the address
followed by the menu option Edit Symbols..., you can also assign symbolic
names to absolute addresses at a later point in time. These assigned names
are automatically entered into the symbol table.
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.

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 9 Symbolic Addressing
Symbol Information in the LAD/STL/FBD Editor

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.10

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.

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 10 Symbolic Addressing
Symbol Selection in LAD/FBD

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.11

Introduction To simply writing a symbolic program , you can use the View Æ Display with Æ
Symbol Selection menu option to show a selection of symbols.
When you label the address 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 are all global variables
(even those declared in data blocks), local variables (temporary and static) and
the parameters of the affected block.
In the first column of the symbol selection you can either display the symbol or
the absolute address. To make the choice, select the Options Æ Settings Æ
View tab menu options in the LAD / FBD / STL Editor and define how you
would like to sort the selection list.

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 11 Symbolic Addressing
Symbol Table: Export

Where do you want to store the table?

In which format do you want to store


the table?

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.12

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

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 12 Symbolic Addressing
Symbol Table: Import

Select directory path

Enter file name

Select file format

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.13

General The Symbol Table Æ Import menu option enables you to import symbol tables
that were created with other user programs.

What to Do 1. Activate the Symbol Table Æ Import menu option.


2. Select the file format in the "Import" dialog window.
You will find the same formats as for Export.
3. Select the directory path in the "Look in:" list box.
4. Enter the file name in the "File Name:" box
5. Click the "Open" button.

File Types You can import 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

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 13 Symbolic Addressing
Exercise 1: Importing a Symbol Table

SIMATIC S7 Date: 18.09.2009


SITRAIN Training for
Automation and Industrial Solutions
Siemens AG 2008. All rights reserved. File: PRO1_05E.14

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.

What to Do 1. In the SIMATIC Manager, open your S7 project called "My_Project" and
select the S7 program of the CPU.
2. Open the still empty symbol table by double-clicking on "Symbols"
3. Import the given symbol table "Symbols_e.dif"
Table Æ Import -> select <Drive>:\S7_Courses\Archive\PRO1 -> Choose
the file "Symbols_e.dif" -> open -> Answer ‘Yes‘ to the message that pops
up that asks if possible comments are to be accepted from the import file.
4. Save the symbol table.

Result All addresses that were assigned a symbolic name in the symbol table can be
addressed absolute or symbolic in the program creation with the LAD/FBD/STL
Editor. Comments from the symbol table can be displayed as "symbol
information".
You can add your own entries to this symbol table at any time, however, you
should not change the already prepared symbol assignments.

SITRAIN Training for ST-PRO1


Automation and Industrial Solutions Page 14 Symbolic Addressing

Вам также может понравиться