DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
| Info | ||
|---|---|---|
| ||
|
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
| Bytes | TIA Name | Suitable Java Equivalent | Supported S7 PLCs |
|---|---|---|---|
| 1 bit | BOOL | boolean | all |
| 1 | BYTE | byte[8]? | all |
| 1 | CHAR, SINT | byte | all |
| 1 | USINT | short | all |
| 2 | INT | short | all |
| 2 | WORD | byte[16]? | all |
| 2 | UNIT | int | all |
| 4 | DWORD | byte[32]? | all |
| 4 | DINT | int | all |
| 4 | UDINT | long | all |
| 4 | REAL | float | all |
| 4 | TIME | ? | ? |
| n+2 | STRING (equals STRING[254]) / STRING[n] |
Syntax
...
| String | all |
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 ULINTULINTtax |
Strings
Please see https://support.industry.siemens.com/tf/WW/en/posts/string-data-type/51621?page=0&pageSize=10
...
| Info |
|---|
Note that a 2 byte prefix is used, so n+2 bytes have to be read from the plc. The first byte represents the max length of the String, i.e., n above. The second one represents the actual length, i.e., the number of bytes to convert to string (starting from offset 2, then). All bytes represent ASCII Chars. |
String Syntax
I did not find any suitable information on how Strings are adressed, except that simple characters can be adressed similar to a byte array.
As it makes no sense at all to use a "width" identifier for the String, I suggest to use the syntax
| Code Block |
|---|
%DB{block-id}.{byte-offset}:STRING[length]
%DB{block-id}.{byte-offset}:STRING |
where the second version refers to the first version with length 254.
This Synatx is motivated by the Syntax which TIA uses e.g. for markers ("%M4.1") where there is only one kind of datatype.
Examples for valid addresses
| 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 | ||||
|---|---|---|---|---|
|