Siemens S7 Protocol

 

If you already know the Siemens Ethernet communication you can skip this chapter.

Settimino, just like Snap7, by design, it only handles Ethernet S7 Protocol communications.

S7 Protocol, is the backbone of the Siemens communications, its Ethernet implementation relies on ISO TCP (RFC1006) which, by design, is block oriented.

 

Each block is named PDU (Protocol Data Unit), its maximum length depends on the CP and is negotiated during the connection.

S7 Protocol is Function oriented or Command oriented, i.e. each transmission contains a command or a reply to it.

If the size of a command doesn't fit in a PDU, then it’s split across more subsequent PDU.

 

Each command consists of

·         A header.

·         A set of parameters.

·         A parameters data.

·         A data block.

 

The first two elements are always present, the other are optional.

 

To understand:

Write this data into DB 10 starting from the offset 4.

Is a command.

Write, DB, 10, 4 and data are the components of the command and are formatted in a message in accord to the protocol specifications.

S7 Protocol, ISO TCP and TCP/IP follow the well-known encapsulation rule : every telegram is the "payload" part of the underlying protocol.

 

Descrizione: C:\Deploy Settimino 1.0\www\s7_protocol_file\image001.png

S7 Commands are divided into categories:

Ø  Data Read/Write

Ø  Cyclic Data Read/Write

Ø  Directory info

Ø  System Info

Ø  Blocks move

Ø  PLC Control

Ø  Date and Time

Ø  Security

Ø  Programming

Siemens provides a lot of FB/FC (PLC side), Simatic NET software (PC side) and a huge excellent documentation about their use, but no internal protocol specifications.

PDU independence

As said, every data packet exchanged with a PLC must fit in a PDU, whose size is fixed and varies from 240 up to 960 bytes.

All Settimino functions completely hide this concept, the data that you can transfer in a single call depends only on the size of the available memory.

If this data size exceeds the PDU size, the packet is automatically split across more subsequent transfers.