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
Enableinput is active, the block reads the value at the configuredDB NumberandDB Byte Addressusing the selectedDB Data Typeand immediately outputs it on theDatasocket.The block expects a connected
S7 Clientprovided to its input. If the client is not connected the block reports a connection error and will not output data.The
Connection Typesetting 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
Add a
Siemens S7 Connectblock and configure the PLC address and connection parameters there.Provide the output of the
Siemens S7 Connectblock to theS7 Clientinput of this block.Set the target
DB NumberandDB Byte Addressusing the controls.Choose the correct
DB Data Typethat matches the PLC variable you want to read.Use a
Logic Inputor other boolean signal to theEnableinput to control when reads occur.Consume the
Dataoutput with visualization, logging or decision blocks.
π‘ Tips and Tricks
Combine with
Siemens S7 Connectto manage the PLC connection centrally β it supplies the client object this block expects on theS7 Clientinput.Use
Logic Inputto enable/disable periodic reads or to implement on-demand reading.If you want to visualize numeric trends, feed the numeric
Dataoutput into aScopeblock for live plotting.To save readings for later analysis, send the
Dataoutput intoData to JSONandCSV Exportblocks.Send telemetry downstream by connecting
DatatoMQTT Publishfor cloud monitoring or toSend Mail(via a structured message) for alerts.Share read results across a scenario using
Data Write Global/Data Read Globalor local memory blocks so other parts of your system can react without re-reading the PLC.For debugging, use
Debug Inputto log the output value and verify addresses and data types.If multiple blocks read/write the same DB area, try switching the
Connection TypetoSyncto 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 Connectblock shows a successful connection. Check network addresses, firewalls and PLC status.Wrong value returned: Confirm the correct
DB Number,DB Byte AddressandDB Data Typematch 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
Syncconnection 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