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

  1. Provide a Modbus client reference by connecting the Modbus Client input. Use the Modbus Connect block to create and share the client.

  2. Set the target register using the Address control.

  3. Select the desired register type using the Data Type control (e.g., Coil or Holding Register).

  4. Feed the value(s) you want to write into the Data input.

  5. Drive the Enable input (for example with a Logic Input or 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 Connect to create and share the Modbus Client across multiple blocks. This keeps connection management separate from the write logic.

  • After writing, verify the result with Modbus Read to confirm the device received the intended values.

  • Control write timing with logic blocks such as Logic Input, Rising Edge or 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 JSON or Data Memory to assemble or store values.

  • To archive or export data written (or read-back confirmations), connect verification outputs into CSV Export or forward results using MQTT Publish for remote logging.

πŸ› οΈ Troubleshooting

  • If nothing is written, ensure the Enable input is TRUE and the Modbus Client input is connected (use Modbus Connect first).

  • If writes fail or the device does not update, confirm the Address and Data Type are correct for your device (coils vs registers).

  • When writing lists of values, ensure the selected Data Type supports multi-value writes (some devices treat coils and registers differently).

  • Use Modbus Read after a write to confirm the device state and to help isolate communication vs configuration issues.

Last updated

Was this helpful?