For the complete documentation index, see llms.txt. This page is also available as Markdown.

Siemens S7 Read

This function block reads data from a Siemens S7 PLC database (DB) and outputs the value for use elsewhere in your scenario. It supports common PLC data types and offers a simple UI to define the DB number, byte address and data type. Use the Enable input to trigger reads and provide a connected S7 Client from a connection block.

πŸ“₯ Inputs

Enable β€” Input socket used to turn reading on or off. Provide a boolean signal (for example from a Logic Input block) to control when reads happen.

S7 Client β€” Input socket that accepts a client/connection object (typically provided by a Siemens S7 Connect block). This tells the block which PLC/server to talk to.

πŸ“€ Outputs

Data β€” Output socket that provides the read value from the PLC. The value type depends on the selected data type (number, string, boolean list, etc.).

πŸ•ΉοΈ Controls

DB Number β€” Enter the DB (data block) number to read from.

DB Byte Address β€” Enter the byte offset inside the DB where the requested value starts.

DB Data Type β€” Dropdown to select the data type to read (examples: Boolean, Int, DInt, Real, String, Word, DWord, Time, ...).

Connection Type β€” Dropdown to choose connection mode (examples: Sync or Async). Use this to control how the block shares/uses a PLC connection with other blocks.

βš™οΈ How it runs

  • When the Enable input is active, the block reads the value at the configured DB Number and DB Byte Address using the selected DB Data Type and immediately outputs it on the Data socket.

  • The block expects a connected S7 Client provided to its input. If the client is not connected the block reports a connection error and will not output data.

  • The Connection Type setting controls whether this block uses a shared (synchronous) connection or a dedicated/asynchronous connection when interacting with the PLC. Choose the mode that fits your setup (see Tips and Tricks).

🎯 Key features

  • Supports many common PLC types: Boolean arrays, integers (SInt/Int/DInt), unsigned types, floating values (Real/LReal), strings, word/dword, and time types.

  • Simple UI controls for DB number / byte address and data type selection.

  • Connection mode selection to fit scenarios where multiple blocks access the same PLC.

  • Returns data in a desktop-friendly format for immediate use by other blocks.

πŸ“ Usage instructions

  1. Add a Siemens S7 Connect block and configure the PLC address and connection parameters there.

  2. Provide the output of the Siemens S7 Connect block to the S7 Client input of this block.

  3. Set the target DB Number and DB Byte Address using the controls.

  4. Choose the correct DB Data Type that matches the PLC variable you want to read.

  5. Use a Logic Input or other boolean signal to the Enable input to control when reads occur.

  6. Consume the Data output with visualization, logging or decision blocks.

πŸ’‘ Tips and Tricks

  • Combine with Siemens S7 Connect to manage the PLC connection centrally β€” it supplies the client object this block expects on the S7 Client input.

  • Use Logic Input to enable/disable periodic reads or to implement on-demand reading.

  • If you want to visualize numeric trends, feed the numeric Data output into a Scope block for live plotting.

  • To save readings for later analysis, send the Data output into Data to JSON and CSV Export blocks.

  • Send telemetry downstream by connecting Data to MQTT Publish for cloud monitoring or to Send Mail (via a structured message) for alerts.

  • Share read results across a scenario using Data Write Global / Data Read Global or local memory blocks so other parts of your system can react without re-reading the PLC.

  • For debugging, use Debug Input to log the output value and verify addresses and data types.

  • If multiple blocks read/write the same DB area, try switching the Connection Type to Sync to avoid concurrency issues.

  • When reading text fields, be mindful of string length and encoding on the PLC. Verify the expected length in the PLC DB to avoid truncated results.

(hint: Useful blocks to combine: Siemens S7 Connect, Logic Input, Number Input, Data to JSON, CSV Export, MQTT Publish, Scope, Debug Input, Data Write Global)

πŸ› οΈ Troubleshooting

  • No data or connection error: Verify the PLC is reachable and that the Siemens S7 Connect block shows a successful connection. Check network addresses, firewalls and PLC status.

  • Wrong value returned: Confirm the correct DB Number, DB Byte Address and DB Data Type match the variable layout in the PLC DB. Off-by-one byte offsets or incorrect data type selection cause invalid results.

  • Partial or truncated string: Ensure the PLC string length matches expectations. If a string appears cut, check the configured length on the PLC side.

  • Intermittent reads or busy server warnings: If the PLC is servicing many requests, try using Sync connection mode for coordinated access or slow down read frequency.

  • Unexpected boolean result: Some boolean reads return groups of bits β€” treat them as collections of boolean values when appropriate.

If problems persist, add a Debug Input block to view raw returned values and feed the results into logging or export blocks to capture failing cases for analysis.

Last updated