Skip to content

Siemens S7

The Siemens S7 connection reads and writes the memory of S7-300, S7-400, S7-1200 and S7-1500 PLCs over the S7 protocol (ISO-on-TCP, port 102). Tags use absolute addresses: data block, offset and format, as in TIA Portal or STEP 7. You do not have to type TIA Portal tags by hand: TIA Portal import creates the connection and tags with real addresses.

S7-300 and S7-400 work right away: you only need the IP address of the CPU or the CP module.

S7-1200 and S7-1500 are closed to external systems by default. In TIA Portal:

  1. CPU properties → Protection & Security → Connection mechanisms → turn on Permit access with PUT/GET communication from remote partner.
  2. For every data block Scadora reads: block properties → Attributes → clear Optimized block access. Otherwise the variables have no absolute offsets.
  3. Download the configuration and blocks to the PLC.

On an S7-1500 with the “Full access protection” level, PUT/GET access must also be allowed by the access level.

Setting Default Meaning
IP address — Address of the CPU or communication module
Port 102 ISO-on-TCP
CPU type S7-1500 S7-300, S7-400, S7-1200, S7-1500
Rack 0 Rack number
Slot 1 S7-1200 and S7-1500: usually 0 or 1, S7-300: 2, S7-400: per the rack configuration
Timeout, ms 3000 Wait for a reply
Max. block, bytes 512 Limit for merging tags into one request
Max. gap, bytes 32 How many unused bytes may be read to merge requests
STRING code page 1251 Encoding of STRING and CHAR: 1251 — Cyrillic, 1252 — Western European. WSTRING is always Unicode

The CPU type list also offers S7-200, S7-200 SMART and LOGO! 0BA8. Scadora has not been tested with them.

S7 address panel

Address Meaning Tag type
DB1.DBX0.1 Data block bit Bool
DB1.DBB2 Byte Byte, SByte
DB1.DBW4 Word Int16, UInt16
DB1.DBD8 Double word Int32, UInt32, Float32
DB1.DBD8 Eight bytes from the start of DBD Int64, UInt64, Float64 (LInt, ULInt, LReal)
M10.0, MB10, MW10, MD10 Markers as for data blocks
I0.0 (E0.0), IW2 Inputs as for data blocks
Q0.0 (A0.0), QW2 Outputs as for data blocks
DB1.STRING10.20 STRING[20] at offset 10 String
DB1.WSTRING40.20 WSTRING[20] String
DB1.CHAR2, DB1.WCHAR4 One character String
DB1.DTL20, DB1.DT32, DB1.DATE40, DB1.TOD42 Date and time String
DB1.S5TIME46 S5TIME Int32, in milliseconds

A leading % is accepted, as in TIA Portal: %DB1.DBX0.1, %MW10. The German letters E and A work too. Strings and time are available in data blocks only. Time is passed as text yyyy-MM-dd HH:mm:ss.fff.

Take offsets from TIA Portal: in a non-optimized block the Offset column shows the byte and bit of each variable. The address width must match the tag type: a Real is DBD, not DBW, otherwise the address panel shows an error.

Reading. Tags of one data block or area that lie close together are merged into one request, so hundreds of tags take a few requests per cycle. Max. gap allows reading a few extra bytes between tags to merge them.

Writing. A value is written at its address and width. A bit (DB1.DBX0.1, M10.0) is written on its own, and neighbouring bits are not touched.

Symptom Cause and what to do
“No connection”, timeout Wrong IP, the PLC is unreachable, or port 102 is blocked
Connection refused Wrong rack or slot. For S7-1200 and S7-1500 try slots 0 and 1
All tags of a block are Bad No such block, the block has optimized access, or PUT/GET is not allowed
Tag Bad The offset is past the end of the data block
Wrong number in a tag The width or type does not match the PLC variable, or the offset points to another variable
Wrong letters in a string STRING code page does not match. Use 1251 for Cyrillic
  • Absolute addresses only. Symbolic access to optimized S7-1200 and S7-1500 blocks is not supported.
  • Timers, counters and peripheral I/O (PIW, PQW) cannot be read by S7 address.
  • Connecting to a PLC with an access protection password is not supported: PUT/GET must be allowed.