Overview of S7 protocol

The following image shows the data source input window for the S7 protocol:

121359682059.png

You can choose between automatic and manual connection type.

  • Automatic: This mode tries to find slot and rack number automatically.

  • Manual: In this mode you can enter the rack and slot number manually.

For S7 connection type the PG type-programmer-type-connection is used thus you will not be able to make use of PG connection.

NOTE

Symbolic access

This solution does not allow full symbolic access.

Requirements for S7-1200 and S7-1500

  • Put/Get communication must be permitted (can be found e.g. S7-1500 -> Properties -> Protection & Security -> Connection mechanisms).

  • The “Optimized block access” of the data blocks that you want to read must be deactivated (can be found in the data block properties).

Address format examples

Detailed examples:

Example address format DB15.DBX6.3:

DB15.DBX6.3

Area indicator

Data type

Offset address

DB15

-

DB

X

6

-

3

Datablock address

Separator

Datablock

Bool

Offset Byte

Separator

Offset Bit

Reads 3rd bit of byte 6 of datablock 15

Example address format IW10:

IW10

Area indicator

Data type

Offset address

I

W

10

Process Input

Word

Offset Byte

Reads a word of input starting from offset 10

Overview

If you want to read data out of other areas, please replace “DB15.DB“ from the examples with the area indicator from the list below. Attention: only certain address examples work with Inputs and Outputs (see 2)).

S7

MindSphere

Data type

Length / unsigned/signed

Data type (length)

Address example

Description

Bool

1 bit

BOOLEAN (1 bit)

DB15.DBX6.3 2)

Reads 3rd bit of byte 6 of datablock 15.

Byte

USInt

1 byte / unsigned

INT (4 bytes)

LONG (8 bytes)

DOUBLE (8 bytes) 1)

DB15.DBB4 2)

DB15.DBBYTE4

Reads an unsigned byte starting from offset 4 out of datablock 15.

SInt

1 byte / signed

Char

1 byte / signed

DB15.DBCHAR6

Reads a char starting from offset 6 of datablock 15.

Word
UInt

2 bytes / unsigned

DB15.DBW10 2)

DB15.DBWORD10

Reads an unsigned word starting from offset 10 of datablock 15.

Int

2 bytes / signed

DB15.DBINT12

Reads a signed integer starting from offset 12 out of datablock 15.

DINT

4 bytes / signed

DB15.DBDINT28

Reads a signed double integer starting from offset 28 of datablock 15.

DWord

UDInt

4 bytes / unsigned

LONG (8 bytes)

DOUBLE (8 bytes) 1)

DB15.DBDW24 2)

DB15.DBDWORD24

Reads an unsigned double word starting from offset 24 of datablock 15.

Real

4 bytes / signed

DOUBLE (8 bytes)

DB15.DBD32 2)

DB15.DBREAL32

Reads a floating-point number starting from offset 32 of datablock 15.

String

Length of variable, max. 254 bytes

STRING (max. 254 bytes)

DB15.DBSTRING10

The maximum string length (Byte10) is read first. Then the number of bytes that Byte10 indicates are read. After that the number of bytes that Byte11 indicates are extracted from the byte array that is the result of second read operation.

For example:

  • (Byte10)- 30

  • (Byte11)-4

  • (Byte12-Byte15)-TEST

First read result: 30

Second read result: 4TEST

We will extract TEST from the second read result by considering Byte11's value.

String

Min. 100 bytes , max. 254 bytes

DB15.DBSTRING10,100

Reads 100 bytes of string starting from offset 10.

1) When DOUBLE is used for integers, they are converted to a floating-point number.

2) For the areas Inputs and Outputs only certain address examples work.

NOTE

Signed values

If you want to read a signed value, you have to use the respective signed datablock.

Example:

DB1831.DBW508 is unsigned. You can use DB1831.DBINT508 instead.

Area Types

S7 datapoint addresses must contain an area type.

Area indicator

Area types

Description

C

Counter

Reads Counter value of hardware.

DB

Datablock

Reads datablock value from hardware.

DI

Instance Data

Reads data directly from hardware.

I

Process Input

Reads Input value of Process image.

M

Memory

Reads Memory value of hardware.

PI

Peripheral Input

Reads Input value directly from hardware.

PQ

Peripheral Output

Reads Output value directly from hardware.

Q

Process Output

Reads Input value of Process image.

T

Timer

Reads Timer value of hardware.

Area Number

S7 datapoint addresses must contain area number.

E.g.: DB10 (10. datablock)

Data Types

The following table shows the MindSphere data types:

MindSphere data types

Data type

Length

Data range

From

To

BOOLEAN

1 bit 

True

False

INT

4 bytes 

−2147483648

2147483647

LONG

8 bytes

−9223372036854775808

9223372036854775807

DOUBLE

8 bytes

-9.9999999999999999999999999999999999999E+125 

9.9999999999999999999999999999999999999E+125

STRING

1 - 255 bytes

The following table shows the S7 data types:

S7 data types

Data type

Length

Data range

From

To

Bool

1 bit

False

True

Byte (unsigned)

1 byte 

0

255

Word (unsigned)

2 bytes

0

65.535

DWord (unsigned)

4 bytes

0

4294967295

Char (signed)

1 byte 

−128

127

Int (signed)

2 bytes

−32768

32767

DINT (signed)

4 bytes

−2147483648

2147483647

Real

4 bytes

+/-1,18e-38

+/-3.40e+38

String

1- 254 bytes

Offset

Variable types must have an offset. Offset is the starting byte number.

E.g. DW4 (a double word starting from byte 4)

String

Data type

Length in bytes

Format

STRING[n] or STRING

n+2

ASCII character of any length. n specifies the length of the character string. A maximum length of 254characters is permitted. If no length is specified, the default setting is 254 characters.

Data type

Examples of format used

STRING[2]

'AB'

STRING[55]

'The character string can consist of up to 55 characters'

NOTE

You must enclose your character string in single quotation marks.

The following example shows the byte order when specifying the datatype STRING[4] with the output value 'AB'.

108219943819.png

* Tod

TIME_OF_DAY (Time)

32

Time is in steps of 1 ms

TOD#0.0.0.0 to TOD#23:59:59.999

L TOD#1:10:3.3

L TIME_OF_DAY#1:10:3.3

* Time

Returns milliseconds.

Format

The DT (DATE_AND_TIME) datatype saves the information on date and time of day in BCD format.

The following table shows the properties of datatype DT:

Length (bytes)

Format

Range of values

Example of value input

8

Date and time

(year-month-day