Modbus Read
This function block reads data from a Modbus server (coils or registers) using a provided Modbus client connection. Use the on-screen controls to select the target address, the number of values to read, and the Modbus data type.
📥 Inputs
Enable A boolean gate to allow or prevent reading. When False the block will not perform a read and returns no data.
Modbus Client Provide a Modbus client connection object (usually coming from a Modbus Connect block). The block uses this client to communicate with the server.
📤 Outputs
Data The read result as a generic list. For register reads this is a list of numeric register values; for coil/discrete reads this is a list of boolean values. If reading fails or is disabled, output is empty/None.
🕹️ Controls
Address Enter the start address (integer) on the Modbus device to read from.
Quantity Enter how many consecutive items (registers or coils) to read.
Data Type Choose the Modbus data type to read: Coil, Discrete Input, Input Register, or Holding Register.
🎯 Features
Supports reading both bit-based (coils/discrete inputs) and word-based (input/holding registers) data types.
Uses an external Modbus client connection provided to the
Modbus Clientinput, keeping communication separate from the block’s settings.Simple numeric and boolean results are returned as a list suitable for logging, plotting, or downstream processing.
Built-in error reporting surfaces communication failures so you can react (reconnect, retry, alert).
⚙️ Running mechanism
When active, the block checks the Enable input and requires a valid client on the Modbus Client input. It reads the configured address range using the selected Data Type and returns the values on the Data output. If the read fails or the block is disabled, it returns no data and logs a helpful error message.
💡 Tips and Tricks
Use
Modbus Connectto create and provide the requiredModbus Clientconnection.Use
Logic InputorRising Edgeto control when reads happen (manual trigger or single-shot reads).To write values back to a device, combine with the
Modbus Writeblock.Log readings for later review using
CSV Exportor persist them withData Write Local/Data Write Global.Visualize numeric outputs in real time by feeding numeric results into the
Scopeblock.Use
Debug Inputto inspect and verify the returnedDataduring setup and troubleshooting.
🛠️ Troubleshooting
No data returned: ensure a valid client is connected to the
Modbus Clientinput andEnableis True.Wrong values or partial reads: check
AddressandQuantityare within the device’s address map and within device limits.Communication errors: verify network/serial settings via the
Modbus Connectblock and ensure no other application is blocking access.Unexpected data format: confirm you selected the correct
Data Type(coils vs registers) for the values you expect.
Last updated