Modbus Write

This function block is used to write data to a Modbus server, facilitating communication between devices in automation systems. It allows the user to specify the address and type of data to be written.

📥 Inputs

Enable A boolean input that activates or deactivates the Modbus write operation.

Modbus Client This input connects to the Modbus client used for communication with the server.

Data The actual data or value to be written to the specified address on the Modbus server.

📤 Outputs

This function block does not produce any outputs.

🕹️ Controls

Address A field to specify the Modbus address where the data will be written.

Data Type A dropdown menu that allows the user to select the type of data being written, either Coil or Holding Register.

🎨 Features

Dynamic Data Writing Users can specify which address and data type to write to in real-time.

Error Logging The block automatically logs errors encountered during the write process, aiding in troubleshooting.

📝 Usage Instructions

  1. Enable the Operation: Ensure the Enable input is set to True.

  2. Specify Address: Enter the Modbus address in the Address input field where you want to write the data.

  3. Select Data Type: Choose the appropriate data type (either Coil or Holding Register) from the Data Type dropdown.

  4. Provide Data: Connect the desired data to the Data input.

  5. Execute the Write: The write operation will be triggered automatically when the inputs are configured and the block is evaluated.

📊 Evaluation

Upon execution, the block will write the specified data to the Modbus server at the defined address and log any errors that occur during the process.

💡 Tips and Tricks

Verifying Modbus Connection

Before writing data, ensure that the Modbus client is properly initialized and connected. You can use a dedicated Modbus monitoring tool to check the connectivity.

Handling Different Data Types

When writing multiple values for Coil or Holding Register, ensure that the data is supplied as a list. If you're writing a single value, ensure it is the correct format that matches the data type being written.

Testing Write Operations

Always test with known addresses and values in a controlled environment to confirm the write operations succeed before deploying to a live system.

🛠️ Troubleshooting

Data Not Writing

If data is not being written, check the following:

  • Ensure the Enable input is set to True.

  • Verify the address is valid and within the correct range for the selected data type.

  • Confirm the Modbus client is connected and functioning correctly.

Error Messages

If you encounter an error message while writing, refer to the log for specific details. Address common errors such as address range issues or unsupported data types according to the Modbus protocol you are using.

Last updated