0% found this document useful (0 votes)
28 views

WinCC Advanced V14 SP1 - Addressing Variables in Global Data Blocks

Uploaded by

Alex
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

WinCC Advanced V14 SP1 - Addressing Variables in Global Data Blocks

Uploaded by

Alex
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

WinCC Advanced V14 SP1

Addressing variables in global data blocks

Addressing variables in global data blocks

Description
Tags in global data blocks can be addressed in symbolic or absolute form. For symbolic
addressing, you use the name of the data block and the name of the tag, separated by a dot.
The name of the data block is enclosed in quotation marks.
For absolute addressing, you use the number of the data block and the absolute address of the
tags in the data block, separated by a dot. The address identifier % is set automatically as prefix
for the absolute address.
The S7-1200/1500 provides you with an option of accessing a data block that is not yet known
during programming. For this purpose, create a block parameter of data type DB_ANY in the
block interface of the accessing block. The data block name or data block number is transferred
to this parameter during runtime. In order to access the internal tags of the data block, use the
name of the block parameter of data type DB_ANY and the absolute address of the tag, separated
by a dot.

Note
Transfer DB with memory reserve to the parameter DB_ANY.
It is not possible to transfer a DB with memory reserve to a block parameter of data type
"DB_ANY".

Note
Addressing DB tags in absolute form
Absolute addressing is not possible for the following tags:
• Tags in blocks with optimized access.

• Tags of data type LWORD, LINT, ULINT, LREAL, LTIME, LTOD and LDT.

Best practice is to use the more convenient symbolic addressing for these tags.

ARRAY data blocks


ARRAY data blocks are a particular type of global data block. These consist of an ARRAY of any
data type. For example, an ARRAY of a PLC data type (UDT) is possible.
You address elements in ARRAY data blocks with the help of the keyword "THIS". The index is
then specified in square brackets. The index can be a constant as well as a tag. Integers with a
width of up to 32 bits are permitted as tags for the index.

This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims all
liability for the completeness of this document. It shall only be used for the user's own internal purposes. It shall not be passed on to third parties.
11/14/2024
WinCC Advanced V14 SP1
Addressing variables in global data blocks

Extended options for addressing ARRAY DBs are available in the "Move" section of the
"Instructions" task card. These instructions give you the option, for example, to also address the
DB name indirectly.

Syntax

"<DBname>".TagName

%<DBnumber>.absoluteAddress

#<DBAny_name>.%absoluteAddress

"<ArrayDBname".THIS[#i].<Component>.<ComponentElement>

SCL:

"<ArrayDBname"."THIS"[#i].<Component>.<ComponentElement>

The following table show the possible absolute addresses of tags in data blocks:

Data type Absolute address Example Description

BOOL %DBn.DBXx.y %DB1.DBX1.0 Data bit 1.0 in DB1

BYTE, CHAR, SINT, USINT %DBn.DBBy %DB1.DBB1 Data bit 1 in DB1

WORD, INT, UINT %DBn. DBWy %DB1.DBW1 Data word 1 in DB1

DWORD, DINT, UDINT, %DBn.DBDy %DB1.DBD1 Data double word 1 in


REAL, TIME DB1

Example
The following examples show the addressing of tags in global data blocks:

Addressing Description

"Motor".Value Symbolic addressing of the "Value" tag in the "Motor" global


data block.
%DB1.DBX1.0 Absolute addressing of the "DBX1.0" tags in the "DB1" global
data block.
#MyDBAny.%DBX30.0 Absolute addressing of the "DBX30.0" tag in the global data
block that is transferred at runtime at the "MyDBany"
parameter.

This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims all
liability for the completeness of this document. It shall only be used for the user's own internal purposes. It shall not be passed on to third parties.
11/14/2024
WinCC Advanced V14 SP1
Addressing variables in global data blocks

Addressing Description

"MyARRAY_DB".THIS Addressing an ARRAY data block. The ARRAY index is specified


[#MyIndex].MyComponent.MyCompone with the "MyIndex" tag. The ARRAY element has two
ntElement additional substructures: "MyComponent" and
"MyComponentElement".

See also
→ Using the DB_ANY data type (S7-1200, S7-1500)
→ Addressing individual characters of a STRING or WSTRING (S7-1200, S7-1500)
→ Addressing PLC data types (UDT)
→ Addressing STRUCT components
→ Addressing ARRAY components
→ Addressing areas of a tag with slice access (S7-1200, S7-1500)
→ Basics of indirect addressing (S7-1200, S7-1500)
→ Addressing instance data

This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims all
liability for the completeness of this document. It shall only be used for the user's own internal purposes. It shall not be passed on to third parties.
11/14/2024

You might also like