Skip to content

Siemens S7 Addressing ​

About 5 min read

On Siemens S7 TCP devices, the absolute S7 address in the PLC is written in the tag's Address field. For device and channel settings, see the Siemens S7 TCP page.

Address Syntax ​

The address specifies the memory area and the start byte (and, for Bool, the bit number). Addresses are written in upper case without spaces.

DB (data block) addresses ​

text
DB<db>.DBX<byte>.<bit>
DB<db>.DBB<byte>
DB<db>.DBW<byte>
DB<db>.DBD<byte>

A dot (.) is used between the DB number and the area; a notation with a comma such as DB1,DBW0 is not accepted.

Input (I), output (Q) and memory (M) addresses ​

text
I<byte>.<bit>   IB<byte>   IW<byte>   ID<byte>
Q<byte>.<bit>   QB<byte>   QW<byte>   QD<byte>
M<byte>.<bit>   MB<byte>   MW<byte>   MD<byte>

German abbreviations are also accepted: E for input (E0.0, EW2), A or O for output (A0.1, AB1).

Timer (T) and counter (C) addresses ​

text
T<number>
C<number>

The German notation Z<number> is also accepted for counters.

Address elements ​

ElementMeaning
DB<db>Data block number, e.g. DB10
I, Q, MInput, output and memory (marker) areas
T, CTimer and counter areas
X + .<bit>Bit access; bit number 0–7
BByte (1 byte)
WWord (2 bytes)
DDouble word (4 bytes)
<byte>Start byte within the area; at most 2097151

DB, timer and counter numbers can be at most 65535.

TIP

The letters B, W and D only indicate the start byte. The tag's Data Type determines the number of bytes read and how the value is decoded. To avoid confusion, choose the letter to match the size of the data type: W for 2-byte types, D for 4-byte types.

Data type and address format ​

  • Bool tags require a bit address: DB<db>.DBX<byte>.<bit> or I/Q/M + <byte>.<bit> (e.g. DB1.DBX0.0, M0.1).
  • A bit address is used only on Bool tags. Other types use a byte, word or double word address (e.g. DB1.DBW0, MW10).
  • Timer and counter addresses contain no bit; Bool is not used on these addresses.

For example, a Bool tag on MW10 or an Int tag on M0.1 is not saved.

Unsupported notations (rejected in the tag table and on the server):

  • Input/output/memory bit addresses with an X prefix, such as IX0.0 or MX10.1: use the I0.0, M10.1 format.
  • A bit address without a bit number (e.g. DB1.DBX0), a DB address without an area (e.g. DB1) and a bit number greater than 7.
  • Lower-case addresses (e.g. db1.dbw0).
  • Peripheral (P) addresses.

When a tag is rejected on save, the error message shows the reason.

Data Types ​

PLC typeData TypeSize readExample address
BOOLBool1 bitDB1.DBX0.0, I0.0, Q0.1, M10.3
BYTE, USINTByte1 byteDB1.DBB1, IB0, QB1, MB5
INTInt2 bytes, signedDB1.DBW2, IW64, MW20
WORD, UINTWord2 bytes, unsignedDB1.DBW4, QW2, MW22
DINTDInt4 bytes, signedDB1.DBD6, MD40
DWORD, UDINTDWord4 bytes, unsignedDB1.DBD10, ID4
REALReal4 bytes, floating pointDB1.DBD14, MD44
LREALLReal8 bytes, floating pointDB1.DBD18
STRING[n]Stringn + 2 bytesDB1.DBB26 (Length = n)

Rules:

  • String: The address points to the start byte of the STRING variable. Enter the maximum number of characters defined in the PLC in the Length field (e.g. 20 for STRING[20]). Only S7 STRING is supported; WSTRING and CHAR arrays are not supported.
  • Length: Must be 1 for types other than String; reading arrays is not supported. Define a separate tag for each element of an array.
  • Sbyte: Not supported on Siemens devices. In the PLC program, copy SINT variables to an INT variable and read it as Int.
  • LInt, ULInt and LWord: Not supported in 2.10; they cannot be selected in the list on Siemens devices and the server rejects them on save. In the PLC program, copy LINT, ULINT and LWORD variables to a DINT, DWORD or LREAL variable and read that one.
  • Automatic: Not supported on Siemens devices; select the Data Type explicitly.

Tags from earlier versions

Tags saved in an earlier version with the LInt, ULInt or LWord type, or with an address that does not match the data type (see Data type and address format), are not deleted. They are not read at runtime, stay at Bad quality, and the reason is written to the service log; writes to these tags are also rejected. To fix them, change the tag's address or data type and save; saving with only a changed description is rejected.

Timer and Counter ​

T<number> and C<number> addresses read the 16-bit raw value of the timer or counter with Data Type Word or Int. The value is not converted to seconds or to a decimal number; for timers, the time base and the BCD-coded value come together. If you need a readable value, copy the timer or counter value in the PLC program to a DB or a memory word (e.g. MW100) and read that address. Only read from timer and counter addresses.

Examples ​

AddressData TypeLengthMeaning
DB1.DBX0.0Bool1DB1, byte 0, bit 0
DB1.DBX0.7Bool1DB1, byte 0, bit 7
DB1.DBB1Byte1DB1, byte 1
DB1.DBW2Int1DB1, bytes 2–3
DB1.DBD6DInt1DB1, bytes 6–9
DB1.DBD14Real1DB1, bytes 14–17
DB1.DBB26String20STRING[20] starting at byte 26 of DB1
I0.0Bool1Input byte 0, bit 0
IW64Int1Input bytes 64–65
Q0.1Bool1Output byte 0, bit 1
QB1Byte1Output byte 1
M10.3Bool1Memory byte 10, bit 3
MW20Word1Memory bytes 20–21
MD44Real1Memory bytes 44–47
T5Word1Raw value of timer 5
C3Word1Raw value of counter 3

Writing to inputs (I) is not recommended; the PLC refills the input area from the physical inputs in every cycle.

2WinScada 2.10