Siemens S7 Overview
TheSIEMENS_S7 route enables direct communication with Siemens S7 PLCs using the native S7 protocol (ISO-on-TCP). It supports all major S7 PLC families and provides access to data blocks, memory areas, inputs, outputs, timers, and counters.
Basic Syntax
Supported CPU Types
| CPU Type | Parameter Value | Typical Slot | Description |
|---|---|---|---|
| S7-200 | S7200 | 0 | Compact micro PLCs |
| S7-300 | S7300 | 2 | Modular PLCs |
| S7-400 | S7400 | 2/3 | High-performance PLCs |
| S7-1200 | S71200 | 1 | Compact controllers |
| S7-1500 | S71500 | 1 | Advanced controllers |
For S7-1200/1500 PLCs, you may need to enable “Permit access with PUT/GET” in the PLC’s protection settings (Hardware Configuration → Protection & Security).
Connection Configuration
S7_CONFIG Parameters
S7 PLC IP address.
CPU type:
S7200, S7300, S7400, S71200, or S71500.PLC rack number. Default: 0.
PLC slot number. Default: 1 for S7-1200/1500, 2 for S7-300/400.
Connection type:
PG (Programming device), OP (Operator Panel), or S7BASIC. Default: PG.Number of retry attempts on failure. Default: 3.
Seconds to wait between retries. Default: 5.
Refresh time in milliseconds. Default: 1000.
Read timeout in milliseconds. Default: 5000.
Write timeout in milliseconds. Default: 5000.
Connection Examples
- S7-1500
- S7-1200
- S7-300
- S7-400
S7 Addressing
Address Format
S7 addresses follow the pattern:<Area><Number>.<Offset> or <DB>.<Type><Offset>
| Address | Description | Example |
|---|---|---|
DBn.DBXx.y | Data Block bit | DB1.DBX0.0 - DB1, byte 0, bit 0 |
DBn.DBBx | Data Block byte | DB1.DBB0 - DB1, byte 0 |
DBn.DBWx | Data Block word (16-bit) | DB1.DBW100 - DB1, word at byte 100 |
DBn.DBDx | Data Block double word (32-bit) | DB1.DBD100 - DB1, dword at byte 100 |
Mx.y | Memory bit | M0.0 - Marker byte 0, bit 0 |
MBx | Memory byte | MB0 - Marker byte 0 |
MWx | Memory word | MW100 - Marker word at byte 100 |
MDx | Memory double word | MD100 - Marker dword at byte 100 |
Ix.y | Input bit | I0.0 - Input byte 0, bit 0 |
IBx | Input byte | IB0 - Input byte 0 |
IWx | Input word | IW0 - Input word at byte 0 |
Qx.y | Output bit | Q0.0 - Output byte 0, bit 0 |
QBx | Output byte | QB0 - Output byte 0 |
QWx | Output word | QW0 - Output word at byte 0 |
Tx | Timer | T0 - Timer 0 |
Cx | Counter | C0 - Counter 0 |
Address Types
Memory area type:
DATABLOCK, MEMORY, INPUT, OUTPUT, TIMER, COUNTER.For most configurations, the ADDRESS_TYPE is inferred from the address format. Use explicit ADDRESS_TYPE when needed for clarity.
Data Types
| Data Type | S7 Type | Size | Description |
|---|---|---|---|
BOOL | BOOL | 1 bit | Boolean value |
BYTE | BYTE | 8 bits | Unsigned 8-bit |
WORD | WORD | 16 bits | Unsigned 16-bit |
DWORD | DWORD | 32 bits | Unsigned 32-bit |
INT / INT16 | INT | 16 bits | Signed 16-bit integer |
UINT16 | UINT | 16 bits | Unsigned 16-bit integer |
DINT / INT32 | DINT | 32 bits | Signed 32-bit integer |
UINT32 | UDINT | 32 bits | Unsigned 32-bit integer |
REAL / FLOAT | REAL | 32 bits | 32-bit floating point |
STRING | STRING | Variable | S7 string type |
TAG Configuration
Complete TAG Example
TAG Parameters
Address Configuration
Address Configuration
Value Transformation
Value Transformation
Filtering
Filtering
Publishing
Publishing
Event-Based Operations
For on-demand operations:Complete Examples
- Basic Data Block Reading
- Memory and I/O
- Bidirectional Control
- Multiple Polling Rates
Read values from a data block:
S7-1200/1500 Setup
Enable PUT/GET Access
- Open TIA Portal project
- Navigate to Device Configuration → Properties
- Go to Protection & Security → Connection mechanisms
- Enable Permit access with PUT/GET communication from remote partner
Optimized Block Access
For S7-1500, ensure data blocks are set to allow standard access:- Open the Data Block in TIA Portal
- In Properties, uncheck Optimized block access
- Compile and download to PLC
Troubleshooting
Connection Refused
Connection Refused
- Verify IP address is correct
- Check PLC is in RUN mode
- For S7-1200/1500: Enable PUT/GET access
- Verify correct RACK and SLOT settings
- Check firewall allows TCP port 102
Wrong Slot Error
Wrong Slot Error
Use correct slot for your CPU:
- S7-1200/1500: Slot 1
- S7-300: Slot 2
- S7-400: Slot 2 or 3 (check hardware config)
Optimized Block Access Error
Optimized Block Access Error
For S7-1500: Disable optimized block access in TIA Portal for data blocks you want to access.
Incorrect Values
Incorrect Values
- Verify address matches TIA Portal
- Check DATA_TYPE corresponds to PLC variable type
- For multi-word types, verify byte offset is correct
- Check BYTE_ORDER if values seem swapped
Write Fails
Write Fails
- Ensure WRITABLE is set to “true”
- Verify PLC is in RUN mode
- Check access permissions in PLC
- Confirm value is within MIN_VALUE/MAX_VALUE

