Modbus Write
This function block is used to send data to a Modbus server (PLC / device). It accepts a prepared Modbus client reference and data to write, and provides simple controls to select the target address and the type of Modbus register to write.
π₯ Inputs
Enable This boolean input controls whether the write action should run. When FALSE or not provided, the block will not perform any write.
Modbus Client This input expects the Modbus client reference (typically provided by the Modbus Connect block).
Data The value or list of values to write to the target Modbus address. Can be a single value or a list depending on the chosen Data Type.
π€ Outputs
This function block does not produce any outputs.
πΉοΈ Controls
Address The target Modbus register address to write data to. Enter the numeric address here.
Data Type Choose between supported Modbus data types (for example Coil or Holding Register). This determines how the input Data will be written.
π― Features
Simple configuration for writing to common Modbus registers.
Supports writing single values or lists of values depending on the selected
Data Type.Respects an enable signal so you can gate writes from logic or UI controls.
Works with a separate Modbus client provider so the connection setup and write operation remain separated and easy to manage.
π Usage Instructions
Provide a Modbus client reference by connecting the
Modbus Clientinput. Use theModbus Connectblock to create and share the client.Set the target register using the
Addresscontrol.Select the desired register type using the
Data Typecontrol (e.g.,CoilorHolding Register).Feed the value(s) you want to write into the
Datainput.Drive the
Enableinput (for example with aLogic Inputor other boolean logic) to perform the write action.
βοΈ Evaluation
When enabled and provided with a valid Modbus client and data, this block writes the provided data to the specified address using the selected Modbus data type. No direct outputs are produced; confirm write success by reading back from the device (for example with the Modbus Read block) or by monitoring the device.
π‘ Tips and Tricks
Use
Modbus Connectto create and share theModbus Clientacross multiple blocks. This keeps connection management separate from the write logic.After writing, verify the result with
Modbus Readto confirm the device received the intended values.Control write timing with logic blocks such as
Logic Input,Rising Edgeor custom logic so writes happen only when needed.If you need to prepare or format complex data before writing, use data helper blocks like
Data to JSONorData Memoryto assemble or store values.To archive or export data written (or read-back confirmations), connect verification outputs into
CSV Exportor forward results usingMQTT Publishfor remote logging.
π οΈ Troubleshooting
If nothing is written, ensure the
Enableinput is TRUE and theModbus Clientinput is connected (useModbus Connectfirst).If writes fail or the device does not update, confirm the
AddressandData Typeare correct for your device (coils vs registers).When writing lists of values, ensure the selected
Data Typesupports multi-value writes (some devices treat coils and registers differently).Use
Modbus Readafter a write to confirm the device state and to help isolate communication vs configuration issues.
Last updated
Was this helpful?