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 Connectto create and manage theS7 Clientconnection and feed it into theS7 Clientinput.To write values back to the PLC after processing, pair this block with
Siemens S7 Write.Use
Logic InputorNumber Inputto control when reads occur (for example poll at a desired rate or triggered reads).For human-readable logging, pipe the output into
Data to JSONorCSV Export.Publish read values to external systems via
MQTT Publishor useREST API - Postfor HTTP-based integrations.Use
Debug Inputto inspect intermediate data andScopeto visualize numeric signals over time.To share read results across a scenario, combine with
Data Write GlobalandData 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 AddressandDB Data Typeexactly match the PLC layout.For
Stringreads, 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 Inputto log raw outputs while tuning addresses and types.
Last updated
Was this helpful?