Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Info
titleWhats missing on this site?
  • Syntax currently only for DB acces
    • Markers
    • I/O
    • Timers, ...
  • We should have a complete list of all supported types and all plcs where they are available (see S7DataType from Chris).
  • We should cleary state all checks and inference the parser does

Address Syntax

The new Syntax has the following motivation

  • Be more familiar with the TIA Syntax well known by S7 programmers
  • Add Type Information to support all available TIA types
  • "Type inference" to be not too verbose

Supported types

BytesTIA NameSuitable Java EquivalentSupported S7 PLCs
1 bitBOOLbooleanall
1BYTEbyte[8]?all
1CHAR, SINTbyteall
1USINTshortall
2INTshortall
2WORDbyte[16]?all
2UNITintall
4DWORDbyte[32]?all
4DINTintall
4UDINTlongall
4REALfloatall
4TIME??
n+2STRING (equals STRING[254]) / STRING[n]Stringall


Syntax

...

Datablocks

Addressing is different for non-primitive and primitive types.

The general syntax for addressing primitive values in a Datablock is

Code Block
%DB{db-number}.DB{bit-length-code}{byte-offset}(.{bit-offset})?

...


db-number: number of datablock
bit-length-code:
	X - 1 bit
	B - 8 bit / 1 byte
	W - 16 bit / 2 byte
	D - 32 bit / 4 byte
byte-offset: offset in byte to start of data block
bit-offset: offset in bit to start of bit

For non primitive objects the (pointer?) notation from TIA is used which is

Code Block
P#DB{db-number}.DBX{byte-offset}.{bit-offset}
Note, here, bit offset is not optional but usually always 0

The parts are:

...

Type identifier Postfix

Primitives

Generally the TIA Syntax is used:

...

Code Block
SINT
USINT
DINT
LREAL
LINT
ULINTtax
Strings

Please see https://support.industry.siemens.com/tf/WW/en/posts/string-data-type/51621?page=0&pageSize=10

...

Code Block
%DB3.DX4.1
%DB3.DX4.1:BOOL
%DB3.DB4:INT
%DB3.DB4:UINT
%DB3.DW4:REAL

Special Data Areas: Markers, Inputs, Outputs

They are always adressed bit-wise and the syntax is similar to TIA.

Code Block
// Marker
%M1.0 // byte 1, bit 0
%I0.5 // byte 0, bit 5
%Q1.1 // byte 1, bit 1

Additional Documents

Programming Guideline

...

View file
nameSCL-cheat-sheet.pdf
height250

Direct Adressing Overview

http://www.multiprojekt.pl/ftp/weintek_hmi/plc_connection_guide/Siemens_S7_1200_S7_1500_absolute_addressing_Ethernet.pdf