Siemens S7 Read

This function block reads values from a Siemens S7 PLC DB area and outputs the retrieved data. Use it to fetch booleans, integers, reals, strings and other PLC data types for further processing or logging.

πŸ“₯ Inputs (sockets)

Enable This input enables the read operation. When not provided or set to False the block will not perform reads.

S7 Client Provide a PLC connection object produced by a connection block (see Tips and Tricks).

πŸ“€ Outputs (sockets)

Data The value read from the PLC. The type and format match the selected data type control (single value, list of booleans, or string).

πŸ•ΉοΈ Controls

DB Number Select the DB number to read from.

DB Byte Address Set the starting byte address inside the selected DB.

DB Data Type Choose the expected PLC data type (examples: Boolean, SInt, Int, DInt, Real, String, Word, DWord). The block converts the raw PLC bytes into a usable value based on this selection.

Data Connection Choose the connection mode. Sync shares a common connection, while Async creates a dedicated connection for this block (useful when multiple blocks access the same addresses concurrently).

✨ Features

  • Connection-aware reads: uses the provided PLC client and will attempt to reconnect when address or connection mode changes.

  • Multiple PLC data types supported including booleans, signed/unsigned integers, floating point, word/dword types and strings.

  • Configurable DB and byte address to target any location inside a DB block.

  • Connection modes for shared or dedicated access to the PLC to accommodate different runtime scenarios.

  • Clear UI messages for connection issues and read failures.

βš™οΈ Running mechanism

When the Enable input is active and a valid S7 Client is available, the block reads the configured DB and byte address using the selected DB Data Type. The converted result is supplied at the Data output socket. If the connection mode, client address or connection state changes, the block will attempt to reconnect according to the chosen Data Connection mode. Errors and busy-server conditions are reported in the block UI so you can adjust settings or retry.

πŸ’‘ Tips and Tricks

  • Use Siemens S7 Connect to create and manage the S7 Client connection and feed it into the S7 Client input.

  • To write values back to the PLC after processing, pair this block with Siemens S7 Write.

  • Use Logic Input or Number Input to control when reads occur (for example poll at a desired rate or triggered reads).

  • For human-readable logging, pipe the output into Data to JSON or CSV Export.

  • Publish read values to external systems via MQTT Publish or use REST API - Post for HTTP-based integrations.

  • Use Debug Input to inspect intermediate data and Scope to visualize numeric signals over time.

  • To share read results across a scenario, combine with Data Write Global and Data Read Global.

  • If reading strings, ensure the PLC string format and length match the block controls; when in doubt, preview with Debug Input.

πŸ› οΈ Troubleshooting

  • If you see a "Server not connected" message, verify network connectivity and that the PLC client is created by Siemens S7 Connect.

  • If reads return unexpected values, confirm that DB Number, DB Byte Address and DB Data Type exactly match the PLC layout.

  • For String reads, ensure the PLC string length/format matches the expected length; mismatches can yield truncated or padded text.

  • If the PLC reports busy or job-pending errors, try switching connection mode or stagger read timings using logic controls.

  • Use Debug Input to log raw outputs while tuning addresses and types.

Last updated

Was this helpful?