Skip to main content
Version: 2.7

Siemens S7 Data Access

This chapter outlines all possible native addresses. These addresses must be configured within the device configuration.

Format

A native Siemens S7 address has following format:

{memory base}.{memory type}.{data type}:{address}

{address} = {MemoryTypeNumber}.{MemoryTypeOffset}.{SliceAccessor}

Example: Plc1.DataBlock.Float32:118.14

This will read 4 Bytes (Float32) of data block (DB) 118 with Offset 14.

Example: Plc1.DataBlock.Bool:118.14.0

This will read the first bit of 1 Byte at offset 14 of data block (DB) 118.

In case of Input or Output Memory input value 0 at the memory type section.

The slice accessor is optional and only valid if a bit is declared as data type. It must be a value between 0 and 7.

Or in case of a single variable:

{memory base}.{memory type}.{data type}:{variable name}

Memory Base

As a Plc only has one memory channel the resulting memory base is always Plc1 (except for diagnosis values):

Memory ChannelDescription
Plc1PLC 1 memory base
GlobalGlobal memory base

Memory Type

The PLC control provides different channels for memory:

Memory ChannelDescription
InputGlobal Input Memory (only available in Plc1 memory base)
OutputGlobal Output Memory (only available in Plc1 memory base)
DataBlockGlobal DataBlock Memory (only available in Plc1 memory base)
MemoryGlobal Memory (User constants, Global Variables, ...; only available in Plc1 memory base)
TimerGlobal Timer Memory (only available in Plc1 memory base)
CounterGlobal Counter Memory (only available in Plc1 memory base)
DiagGlobal Diagnosis Values (only available in Global memory base)

Data Types

Data types are part of a HumanOS® data address. Common conversions are:

Data Type (Siemens)DescriptionSystem Data TypeHumanOS® Adress Data Type
BOOLBit information. 0 = not set; 1 = setSystem.BooleanBool
BYTEByte information (unsigned 8bit integer)System.ByteUint8
SINTByte information (signed 8bit integer)System.Int8Int8
USINTByte information (unsigned 8bit integer)System.UInt8Uint8
WORDWord information (unsigned 16bit integer)System.UInt16Uint16
INTInt information (signed 16bit integer)System.Int16Int16
UINTUint information (unsigned 16bit integer)System.UInt16Uint16
DWORDDword information (unsigned 16bit integer)System.UInt32Uint32
DINTDint information (signed 32bit integer)System.Int32Int32
UDINTUdint information (unsigned 32bit integer)System.UInt32Uint32
REALFloating point number (signed 32bit)System.SingleFloat32
LREALFloating point number (signed 64bit)System.DoubleFloat64
LWORDLword information (unsigned 64bit integer)System.UInt64Uint64
LINTLint information (signed 64bit integer)System.Int64Int64
ULINTUlint information (unsigned 64bit integer)System.UInt64Uint64
ARRAY OF BYTEArray of Bytes (Array of unsigned 8bit integer)System.Byte[]ByteArray
STRING / STRING[n]String informationSystem.StringString
INFORMATION

Strings must be specified from their address offset. See example in memory configuration datablock. Ignoring to do so will result in faulty values. If the string is specified with a length indicator in the plc, remember to calculate your length => string[x] : x+2 bytes

Memory Type Number

The memory type number is limited by the memory type:

INFORMATION

Memory ranges depend on the memory type:

  • Input/Output: always 0
  • DataBlock/ Memory/Timer/Counter: 0-65535

Memory Type Configuration

Input

The input channel can only be read or monitored. Writing is not possible.

Address ExampleDescriptionData Type
Plc1.Input.Float32:0.14Reads 4 Bytes from I 14.0System.Double
Plc1.Input.Bool:0.1Reads second bit from first byteSystem.Boolean

Output

The configuration can only be read or monitored. For writing, use the appropriate command.

Address ExampleDescriptionData Type
Plc1.Output.Float32:0.14Reads 4 Bytes from Q 14.0System.Double

DataBlock

The values can only be read or monitored. For writing, use the appropriate command.

Address ExampleDescriptionData Type
Plc1.DataBlock.Float32:100.14Reads 4 Bytes from DB 100 offset 14System.Double
Plc1.DataBlock.String:2.20[4]Reads a string with length of 2 Bytes (offset 22) from DB 2 offset 20System.String
Plc1.DataBlock.Bool:2.0.1Reads second bit from first byte from DB 2System.Boolean

Counter

The values can only be read or monitored. This does not work on all cpus.

Address ExampleDescriptionData Type
Plc1.Counter.Int32:1Reads the global counter value from C1System.Int32

Timer

The values can only be read or monitored. This does not work on all cpus.

Address ExampleDescriptionData Type
Plc1.Timer.Int32:1Reads the global timer value from T1System.Int32

Memory

The values can only be read or monitored.

Address ExampleDescriptionData Type
Plc1.Memory.Int32:1Reads the global Memory from Byte 1 -- see the appropriate Memory location in the PLC for OffsetsSystem.Int32

Variable

CAUTION

Variables are very inefficient in terms of speed. A separate call is made to the PLC for each variable. Use memory types if possible.

INFORMATION

All 64-bit values are not supported.

The values can only be read or monitored. For writing, use the appropriate command. Reading arrays is not possible (Strings also count as arrays), use the appropriate memory type for that.

Address ExampleDescriptionData Type
Plc1.Variable.Uint16:DB10.DBW20Reads the Word with offset 20 in the DB 10System.Uint16
Plc1.Variable.Int16:DB10.DBW20Reads the int with offset 20 in the DB 10System.Int16
Plc1.Variable.Int32:DB2.DBD1338Reads the int with offset 1338 in the DB 2System.Int32
Plc1.Variable.Float32:DB2.DBD14Reads the float with offset 14 in the DB 2System.Single
Plc1.Variable.Bool:DB2.DBX0.0Reads the first bool with offset 0 in the DB 2System.Boolean
Plc1.Variable.Uint8:DB2.DBB1320Reads the byte with offset 1320 in the DB 2System.Byte
Plc1.Variable.Int8:DB2.DBB1342Reads the int with offset 1342 in the DB 2System.Int16

Accepted data and memory type definitions

Definer(s)Memory TypeData Length (bytes)
DBBDatablock1
DBWDatablock2
DBDDatablock4
DBXDatablock1 (reads bit x from 1 byte)
IB / EBInput1
IW / EWInput2
ID / EDInput4
E / IInput1 (reads bit x from 1 byte)
QB / AB / OBOutput1
QW / AW / OWOutput2
QD / AD / ODOutput4
Q / A / OOutput1 (reads bit x from 1 byte)
MBGlobal Memory1
MWGlobal Memory2
MDGlobal Memory4
MGlobal Memory1 (reads bit x from 1 byte)

Diag

The values can only be read or monitored. Supported values are:

Address ExampleDescriptionData Type
Global.Diag.Int32:1Connection status to PLC (1=Connected)System.Int32
Global.Diag.Int32:2Connection life bit (toggling in 1Hz)System.Int32

Device Info Example

{
"Id": "d5baf54a-10e6-4cf4-866e-bfbae46e01c2",
"Name": "S7 Control",
"DriverId": "F25F68F9-C720-4DD9-8A28-957C84AAA98C",
"Address": "Cpu=S7400;Address=192.168.44.86;Rack=0;Slot=5",
"Properties": [
{
"Name": "TcpTimeout",
"Value": 5000,
"DataType": "System.Int32"
}
],
"DataNodes": [
{
"Id": "a89475ce-66c2-4025-acba-e96b9ed5921d",
"Name": "MyValues",
"DataType": "System.Double",
"DataClass": "Event",
"Address": "Plc1.DataBlock.Float32:151.14",
"Access": {
"Read": true,
"Receive": true
}
}
],
"AlarmEventPool": {
"Id": "0efafbcd-447a-4fb6-900d-51affdc25e8f",
"Name": "Alarming",
"HistoryMode": {
"Retention": 20,
"SamplingRate": 2000
},
"Tasks": [
{
"Id": "66d0a44d-83e8-494d-9e15-5af16df60d55",
"Name": "Alarm Messages",
"Address": "Plc1.OEMAlarmEvent:0",
"Properties": [
{
"Name": "MessageMappingFile",
"Value": "Signallist.json"
},
{
"Name": "MessageCount",
"Value": 187,
"DataType": "System.Int32"
},
{
"Name": "StartAddress",
"Value": "Plc1.DataBlock.ByteArray:970.0[47]"
},
{
"Name": "MessageFormat",
"Value": "BitMessage"
},
{
"Name": "Message:Type",
"Value": "Raise"
}
]
},
{
"Id": "f2280557-9806-414d-b002-aa3e30fb79b5",
"Name": "Alarm Confirm Messages",
"Address": "Plc1.OEMAlarmEvent:0",
"Properties": [
{
"Name": "MessageMappingFile",
"Value": "Signallist.json"
},
{
"Name": "MessageCount",
"Value": 187,
"DataType": "System.Int32"
},
{
"Name": "StartAddress",
"Value": "Plc1.DataBlock.ByteArray:971.0[47]"
},
{
"Name": "MessageFormat",
"Value": "BitMessage"
},
{
"Name": "Message:Type",
"Value": "Confirm"
}
]
}
]
}
}