Symbol Table/ Global Variable Table

Related Topics

Open a Symbol Table (in SIMATIC mode) or Global Variable Table (in IEC 1131-3 mode) by using one of the following methods:

·Click the Symbol Table button on the Navigation Bar.

·Select the View > Symbol Table menu command.

·Open the Symbol Table or Global Variable Folder in the Instruction Tree , then double click on a table icon.

This topic discusses the following information:

Editing in a Table

Making Symbol Assignments in a Table

Use of Quotation Marks No Longer Supported

Inserting Additional Rows

Using the Define Symbol Command

Sorting by Column

Working with Multiple Tables

Creating Additional Symbol Tables

Moving between Symbol Tables

The POU Symbols Tab

Symbolic and Absolute Views

Toggling between Symbolic and Absolute Address View

Viewing Symbolic and Absolute Addresses Simultaneously

Understanding Symbols

Understanding Symbol Scope

Using Indirect Notation

Memory Types

Entry Errors and Troubleshooting

Tips

SIMATIC versus IEC

Examples of SIMATIC and IEC Tables

Making Symbol Assignments in the Symbol Table/ Global Variable Table

Back to Top

To assign a symbol to an address, follow the procedure below:

1.Open the Symbol Table/ Global Variable Table (by using one of the procedures described at the beginning of this topic).

2.Type the symbol name (for example, Input1) in the Symbol Name column. The maximum symbol length is 23 characters. Use the TAB, ENTER, or ARROW keys to confirm your work and move to the next cell.
Notes:
* Until you assign an address to the symbol, it is shown as an undefined symbol (green wavy underline). After you complete the Address column assignment, the green wavy underline is removed.
* If you have selected simultaneous symbolic and absolute view of operands for your project, lengthy symbolic names are truncated with a tilde (~) in the LAD and FBD Program Editor windows. You can place your mouse pointer over the truncated name to see the entire name displayed in a tooltip.

3.Type the address (for example, I0.0) in the Address column.
(In IEC 1131-3 programming mode, the correct IEC “%” prefix is added automatically for you after you type the address.)

4.If you are using the IEC Global Variable Table, type a value in the Data Type column or select one from the listbox.
(SIMATIC users do not need to supply a Data Type.)

5.Type in a comment (optional:79 characters maximum).

Note:

In STEP 7-Micro/WIN 32, you can create multiple Symbol Tables (SIMATIC programming mode) or multiple Global Variable Tables (IEC 1131-3 programming mode). However, it is not valid to use the same string more than once as a global symbol assignment: neither within a single table nor among several tables.

(By contrast, it is valid to use the same string in as many different Local Variable Tables as you choose.)

Use of Quotation Marks No Longer Supported

Back to Top

Prior to version 3.1, global symbol names had to be enclosed in double quotation marks. Double quotation marks are no longer used; the Symbol Table treats them as illegal syntax (symbol is displayed in red until quotation marks are removed).

Inserting Additional Rows

Back to Top

Use one of the following methods to insert additional rows into a symbol table/ global variable table:

·Choose the menu command Edit>Insert>Row. A new row is inserted above the current location of the cursor in the symbol table/ global variable table.

·Right-click on a cell of the symbol table/ global variable table. Choose the pop-up menu command Insert>Row. A new row is inserted above the current location of the cursor.

·To insert a new row at the bottom of the Symbol Table, place the cursor in any cell of the last row and press the DOWN ARROW key .

Using the Define Symbol Command

Back to Top

The Define Symbol command allows you to select an existing symbol from a list, and it also allows you to create new symbol assignments while you work in the Program Editor window or Status Chart, without having to open up the Symbol Table.

Tip:

You cannot use the Define Symbol command unless you are working in Symbolic Addressing view. (Examine the Symbolic Addressing option underneath the View menu: a checkmark means that Symbolic Addressing view is turned on.)

To invoke the Define Symbol command :

1.Type at least one character of the desired symbol name in the Program Editor window or a Status Chart address cell and press the ENTER key.

2.Right-click on the incomplete (or incorrect) symbol name, then select Define Symbol from the pop-up menu.

3.Choose an existing symbol from the list, or define a new symbol in the Define Symbol dialog box.

4.Click "OK" to confirm your work and close the dialog box, or click "Cancel" to cancel.

Note: If you have selected simultaneous symbolic and absolute view of operands for your project, lengthy symbolic names are truncated with a tilde (~) in the LAD and FBD Program Editor windows. You can place your mouse pointer over the truncated name to see the entire name displayed in a tooltip.

Sorting by Column

Back to Top

You can sort the table by the Name or by the Address column. You can sort a column in ascending or descending (alphabetical) order.

To sort a column in a particular order, select the column by clicking in the body. Avoid clicking on the column header ("Name" or "Address") at the top of the column.

·To sort the column in ascending order, from A to Z, click the Sort Ascending button or choose the menu command View > Sort Ascending.

·To sort the column in descending order, from Z to A, click the Sort Descending button or choose the menu command View > Sort Descending.

To reverse the sort, click on the column header ("Name" or "Address") at the top of the column. When you click on the column header, you toggle between ascending and descending sorts.

Creating Additional Symbol Tables

Back to Top

By default, the Symbol Table window displays one tab for user-defined symbolic names (USR1). If you have renamed any POUs, the Symbol Table window shows a tab called "POU Symbols"-- if you are using a Pro feature like the USS Protocol Library, the window shows a "USS Protocol" tab.

There are several ways to create additional Symbol Tables for user-defined symbolic names:

·From the Instruction Tree, right-click on the Symbol Table folder and choose the pop-up menu command Insert Symbol Table.

·Open the Symbol Table window and use the Edit menu, or right-click to bring up a pop-up menu, and choose Insert>Table.

Note: After you successfully insert a new Symbol Table, a new tab appears at the bottom of the Symbol Table window.

Moving between Symbol Tables

Back to Top

If you have created more than one Symbol Table, you can access the tables by any of the following methods:

·If the Symbol Table window is open, click on the tabs at the bottom of the Symbol Table window to move between tables.

·From the Instruction Tree, expand the Symbol Table folder icon and double-click on the desired Symbol Table icon to view the tab for that table within the Symbol Table window.

The POU Symbols Tab

Back to Top

If you have assigned symbolic names for any of the POUs or other components (such as a data block, status chart, or symbol table) of your project, the symbolic name assignments are listed in the "POU Symbols" tab of the Symbol Table window.

This tab is read-only; you cannot edit the assignments from here.

If you want to change an assignment, you must edit the Properties dialog box for the component in question. (From the Project branch of the Instruction Tree, right-click on the component to bring up its Properties dialog box.)

All symbolic assignments must use valid syntax. (See Entry Errors, below.) If you violate the guidelines for making a symbolic name assignment, STEP 7-Micro/WIN 32 reports an error when you try to compile your program.

Toggling between Symbolic and Absolute Address Views

Back to Top

After you make symbol and absolute address associations in a Symbol Table/ Global Variable Table, you can toggle between symbolic and absolute display of operand addresses. Use one of the following methods:

·Choose the menu command View>Symbolic Addressing to toggle symbolic addressing on and off

·Use the Ctrl+Y shortcut key to toggle symbolic addressing on and off

A checkmark before the Symbolic Addressing menu item means that symbolic addressing is on. By default, symbolic addressing is on when you open your first project.

Viewing Symbolic and Absolute Addresses Simultaneously

Back to Top

To view symbolic addresses and absolute addresses simultaneously in a LAD or FBD program, use the menu command Tools>Options and choose the LAD Editing or FBD Editing tab. Select the radio button "Display symbol and address."

Tips:

·Symbolic addresses are only displayed in your project when the Symbolic Addresses view is on. Otherwise, even if you select "Display symbol and address," only the absolute address is shown.

·If you have selected simultaneous symbolic and absolute view of operands for your project, lengthy symbolic names are truncated with a tilde (~) in the LAD and FBD Program Editor windows. You can place your mouse pointer over the truncated name to see the entire name displayed in a tooltip.

Understanding Symbol Scope

Back to Top

The Symbol Table/ Global Variable Table assigns symbolic names to PLC memory and I/O addresses. When you define a symbol in the Symbol Table/ Global Variable Table, the symbol has global scope. This means you can use the name of the symbol in any POU as a reference to the data at the address of that symbol. (By contrast, if you assign a symbolic name using a Local Variable Table, the local variable is restricted in scope to the POU where it has been defined.)

Using Indirect Notation

Back to Top

You can use indirect notation (& and *) with symbols just as with absolute addresses. For more information about indirect addressing, see Direct and Indirect Addressing.

Memory Types

Back to Top

You can create symbol names for the following memory types: I, Q, M, SM, AI, AQ, V, S, C, T, HC

Entry Errors

Back to Top

Entry errors are color-coded to make them easy to see:

·Illegal Syntax - Red Text

Example:

(number character illegal for first character)

(illegal address VB0 is correct)

(reserved keywords cannot be used as symbols)


·Illegal Use - Red Wavy Underline

Example:

(duplicate name)

(duplicate address)


·Undefined Symbol - Green Wavy Underline

Example:

(name with invalid address) SIMATIC mode

(name with invalid address or data type) IEC mode


Notes:

·Symbolic names are permitted to contain alphanumeric characters and underscores. They are also permitted to contain extended characters (ASCII 128 to ASCII 255). The first character is restricted to alpha and extended characters only.

·Prior to version 3.1, global symbol names had to be enclosed in double quotation marks. Double quotation marks are no longer used; the Symbol Table treats them as illegal syntax (symbol is displayed in red until quotation marks are removed).

·It is illegal to use keywords as symbolic names, or to use names that begin with a number or contain characters that are not alphanumeric or in the extended character set.

·The maximum length permitted for a symbolic name is 23 characters.

·If you attempt to create a symbol assignment to correct the Undefined Symbol error for an operand in your program, but do not press the TAB key, ENTER key, or an ARROW key after typing the Address value, when you go back to the Program Editor, the operand still displays the Undefined Symbol error. To resolve this problem, return to the Symbol Table window, place the cursor in the Address cell, and press the TAB, ENTER or ARROW key to complete the address assignment.

Tips for Creating Symbols

Back to Top

·You can make symbol assignments at any time: before, during, or after the creation of program logic.

·You can document your symbols by making remarks in the Comments column.

·You can use the Define Symbol command to select from a list or create new symbol names as you program.

·You can sort the values in the Symbol Table/ Global Variable Table by clicking on the various table columns.

·You can resize columns by dragging on their edges.

·You can use the File>Print command and select the appropriate checkbox to print the Symbol Table/ Global Variable Table.

·Once you create symbol assignments, you can display your address assignments and symbol comments after each network in the LAD/ FBD program editors by enabling the symbol information table feature.

Examples of SIMATIC and IEC Tables

Back to Top

The only functional distinction between a Symbol Table (SIMATIC programming mode) and a Global Variable Table (IEC programming mode) is the Data Type column, which is unique to IEC programming. IEC-1131 is a strongly typed language. Instruction operands are defined to accept one specific data type. For information about data types, see SIMATIC and IEC 1131-3 Data Types.

This is an example of a SIMATIC Symbol Table:

This is an example of an IEC Global Variable Table:

Back to Top

See Also:

Local Variable Table

View Symbolic Addressing

Network Symbol Information Tables (LAD/ FBD)

Addressing Overview

Direct and Indirect Addressing

Keyword List