ReferenceDriverModbusWrite Task

Modbus Write Task

Learn how to send commands to Modbus TCP devices with Synnax.

For task lifecycle management, see the Task Basics page.

How Commands Work

Modbus Write Tasks use command channels to send values to the server:

  • Command channels: Write values here to send commands to the Modbus server
  • Command time channels (_cmd_time): Index channels storing command timestamps

Modbus write tasks do not create separate state channels. To read back the current state, configure a read task for the same address.

Task Configuration Reference

ParameterTypeRequiredDefaultDescription
namestringYes-Human-readable task name
devicestringYes-Key of the Modbus server device
auto_startbooleanNofalseAutomatically start task after configuration
channelsarrayYes-List of output channel configurations

Register Types Reference

Holding Register Output (holding_register_output)

Writes to 16-bit read/write registers (Function Code 06/16). Typically used for setpoints, control values, and configuration parameters.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax command channel key
addressnumberYes-Modbus register address (0-65535)
data_typeenumNofloat32Data type: int16, uint16, int32, uint32, float32
swap_bytesbooleanNofalseSwap byte order within 16-bit words
swap_wordsbooleanNofalseSwap word order for 32-bit+ values

Data Type Sizes:

  • int16/uint16: 1 register (2 bytes)
  • int32/uint32/float32: 2 registers (4 bytes)

Coil Output (coil_output)

Writes to 1-bit read/write coils (Function Code 05/15). Typically used for binary control signals like relay states and valve positions.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax command channel key
addressnumberYes-Modbus coil address (0-65535)

Data Type: Always boolean (0/1)

Important Rules

  • Direct write: Commands are written directly to the Modbus server without state feedback channels.
  • One running task per register: A register/coil can only be controlled by one task at a time.
  • Byte/word order: Ensure swap settings match your server configuration for multi-register data types.
  • Read-only registers: Input Registers and Discrete Inputs cannot be written to.

How-To

Console

Python

TypeScript