The S7 item syntax is set up as shown below:
<Area><Data type><Start address>[.Array size][Suffix]
|
If the data type is BOOL, the bit number is required:
<Area><Data type><Start address><.Bit number>[.Array size]
|
If the data type is STRING, the string length is required:
<Area><Data type><Start address><.String length>[.Array size][Suffix]
|
Legend: <> mandatory [ ] optional
<Area>
|
Syntax
|
Orientation1
|
Access Rights
|
Notes
|
Data block
|
DBx.
V synonym for DB1
|
BYTE
|
Read / write
|
With data blocks, the specification of a block number x is required (x = 1 to 65535). A dot must appear after the block number.
|
Instance block
|
DIx.
|
BYTE
|
Read / write
|
Flag
|
M or F
|
BYTE
|
Read / write
|
|
Timer
|
T
|
WORD
|
Read
|
directly followed by the timer number.
The data type is REAL, with suffix S5T STRING
|
Counter
|
Z or C
|
WORD
|
Read / write
|
directly followed by the counter number.
|
Input
|
E or I
|
BYTE
|
Read
|
|
Output
|
A or O or Q
|
BYTE
|
Read / write
|
|
I/O Input
|
PE or PI
|
BYTE
|
Read
|
|
I/O Output
|
PA or PO or PQ
|
BYTE
|
Read / write
|
|
1BYTE-oriented means that a byte is addressed for each physical address.
WORD-oriented means that a word (16 bits) is addressed for each physical address.
<Data type>
Type
|
Syntax
|
DB / DI
|
M
|
I/O
|
PI /PO
|
C/T
|
with Array
|
useful
Suffixes
|
BIT
VT_BOOL
|
X
|
DB5.X4.3
|
MX1.3
|
---
|
---
|
---
|
---
|
---
|
BIT
VT_BOOL
|
|
DB5.4.3
|
M1.3
|
E4.3
I4.3
A4.3
O4.3
|
PE4.5
PI4.5
PA1.3
PO1.3
|
---
|
---
|
---
|
BYTE
VT_UI1
|
B
Byte
|
DB5.B2
DB5.Byte2
|
MB4
MByte4
FB4
FByte4
|
EB4
EByte4
IB4
IByte4
AB5
AByte5
OB5
OByte5
|
PEB4
PEByte4
PIB4
PIByte4
PAB5
PAByte5
POB5
POByte5
|
---
|
DB5.B2.4
DB5.Byte2.4
MB4.3
MByte4.3
FB4.4
FByte4.4
POB5.3
etc.
|
KF
BCD
|
WORD
VT_UI2
VT_I4*
|
W
Word
|
DB5.W3
DB5.Word3
|
MW4
MWord4
FW4
FWord4
|
EW4
EWord4
IW4
IWord4
AW5
AWord5
OW5
OWord5
QWord5
|
PEW4
PEWord4
PIW4
PIWord4
PAWord5
PAWord5
POW5
POWord5
|
C5
Z5
T5
|
DB5.W3.2
DB5.Word3.2
MW4.2
EWord4.2
PAWord5.3
C5.3
Z5.10
T5.2
etc.
|
KF
BCD
KT
S5T
TR
D
SWAP
|
INT
VT_I2
|
I
Int
|
DB5.I3
DB5.Int3
|
MI4
MInt4
FI4
FInt4
|
EI4
EInt4
II4
IInt4
AI5
AInt5
OI5
OInt5
|
PEI4
PEInt4
PII4
PIInt4
PAI5
PAInt5
POI5
POInt5
|
---
|
DB5.I3.2
DB5.Int3.2
MI4.4
FInt4.3
AInt5.3
OI5.2
OInt5.5
POInt5.4
etc.
|
SWAP
|
REAL
VT_R4
|
R
Real
|
DB5.R2
DB5.REAL2
|
MR4
MREAL4
|
ER4
EREAL4
IR4
IREAL4
AR4
AREAL4
OR4
OREAL4
|
PER4
PEREAL4
PIR4
PIREAL4
PAR4
PAREAL4
POR4
POREAL4
|
----
|
DB5.R2.2
DB5.REAL2.4
MR4.5
ER4.4
AREAL4.5
PER4.2
PAR4.7
POR4.3
etc.
|
KG
SWAP
|
STRING
VT_BSTR
|
S
String
|
DB5.S1.80
DB5.String1.80
|
MS2.80
MString2.80
|
---
|
---
|
---
|
DB5.S1.80.5
DB5.String1.80.5
MS2.80.3
MString2.80.3
|
KA1
|
S7-STRING
VT_BSTR
|
G
SS
|
DB5.G2.80
DB5.SS2.80
|
MG2.80
MSS2.80
|
---
|
---
|
---
|
DB5.G2.80.5
DB5.SS2.80.5
MG2.80.5
MSS2.80.5
|
---
|
S5-STRING
VT_BSTR
|
SF
|
DB5.SF2.80
|
FSF2.80
|
---
|
---
|
---
|
DB5.SF2.80.5
MSF2.80.5
|
---
|
DOUBLE WORD
VT_UI4
VT_R8*
|
DW
Dword
|
DB5.DW3
DB5.Dword3
|
MDW4
MDWord4
FDW4
FDWord4
|
EDW4
EDWord4
IDW4
IDWord4
ADW5
ADWord5
ODW5
ODWord5
QDW5
|
PEDW4
PEDWord4
PIDW4
PIDWord4
PADW5
PADWord5
PODW5
PODWord5
|
---
|
DB5.DW3
MDW4.2
FDW4.2
EDW4.4
ADWord5.8
PEDW4.8
PADW5.4
PODW5.4
etc.
|
KF
BCD
KG
T
TOD
SWAP
|
DOUBLE INT
VT_I4
|
D
DI
DInt
|
DB5.D3 2
DB5.DI3
DB5.DInt3
|
MDI4
MDInt4
FDI4
FDInt4
|
EDI4
EDInt4
IDI4
IDInt4
ADI5
ADInt5
ODI5
ODInt5
QDI5
|
PEDI4
PEDInt4
PIDI4
PIDInt4
PADI5
PADInt5
PODI5
PODInt5
|
---
|
DB5.D3.2
DB5.DI3.2
DB5.DInt3.4
MDI4.5
EDI4.5
ADI5.2
PEDI4.5
PADInt5.2
etc.
|
BCD
T
TOD
SWAP
|
QUAD WORD
VT_UI8
|
QW
Qword
|
DB5.QW3
DB5.Qword3
|
MQW4
MQWord4
FQW4
FQWord4
|
EQW4
EQWord4
IQW4
IQWord4
AQW5
AQWord5
OQW5
OQWord5
QQW5
|
PEQW4
PEQWord4
PIQW4
PIQWord4
PAQW5
PAQWord5
POQW5
POQWord5
|
---
|
DB5.QW3
MQW4.2
FQW4.2
EQW4.4
AQWord5.8
PEQW4.8
PAQW5.4
POQW5.4
etc.
|
KF
BCD
SWAP
|
QUAD INT
VT_I8
|
Q
QI
QInt
|
DB5.Q3
DB5.QI3
DB5.QInt3
|
MQI4
MQInt4
FQI4
FQInt4
|
EQI4
EQInt4
IQI4
IQInt4
AQI5
AQInt5
OQI5
OQInt5
QQI5
|
PEQI4
PEQInt4
PIQI4
PIQInt4
PAQI5
PAQInt5
POQI5
POQInt5
|
---
|
DB5.Q3.2
DB5.QI3.2
DB5.QInt3.4
MQI4.5
EQI4.5
AQI5.2
PEQI4.5
PAQInt5.2
etc.
|
SWAP
|
DOUBLE
VT_R8
|
QR
QReal
|
DB5.QR2
DB5.QREAL2
|
MQR4
MQREAL4
|
EQR4
EQREAL4
IQR4
IQREAL4
AQR4
AQREAL4
OQR4
OQREAL4
|
PEQR4
PEQREAL4
PIQR4
PIQREAL4
PAQR4
PAQREAL4
POQR4
POQREAL4
|
----
|
DB5.QR2.2
DB5.QREAL2.4
MQR4.5
EQR4.4
AQREAL4.5
PEQR4.2
PAQR4.7
POQR4.3
etc.
|
SWAP
|
Date and Time
VT_DATE
|
DT
|
DB5.DT3
|
MDT4
|
EDT4
IDT4
ADT5
ODT5
QDI5
|
PEDT4
PIDT4
PADT5
PODT5
|
---
|
DB5.DT3.2
MDT4.2
EDT4.2
PEDT4.2
etc.
|
ISO
|
1 KA Suffix is not possible with string arrays
2 Caution! Danger of mix up with S5 syntax for bit (DB5D1.1)
Notes on counters and timers
Counters and timers are always addressed by words. For this reason, the specification of a data type is not required!
The start address directly follows the “T” or “C/Z” area. Timers can only be read! Counters can be read and written.
Timer values are indicated in seconds (e.g., T = 0.7 => T = 0.7 s = 700 ms).
Counters are represented in decimals (0 to 999).
<Start address>
The start address specifies the addresses starting at which can be read or written.
Example: DB5.DW6: Double word 6 of the data block 5 is the start address.
Example: MB17: Flag byte 17 is the start address.
If the start address is a certain bit, the bit number must also be specified.
<.Bit number>
The bit number must always be specified when the data type is BOOL.
Example: I4.3: bit 3 of input byte 4 – an input bit is addressed here.
Example: MX12.1: Bit 1 of flag byte 12 – a flag bit is addressed here.
[.Array size]
An array (i.e., field, row, data area) is a series of equal elements. An array combines several units of one data type into a field. If, for example, several words are read out from a data block, this is called an array of words. To create an array, the length of the array is added to the standard syntax separated by a dot.
Example: DB10.REAL2.5.
For more information on arrays, see also Arrays.
[Suffix]
A value can be represented in another format with the aid of a suffix.
For more information on suffixes, see also Suffixes.
|