Modbus Server trigger event
The execution of a trigger can be controlled by the
receipt of a Modbus write command processed by the Modbus
Server. Clients that interface with the Modbus server can
modify coils and holding registers defined on the Modbus
Server, using either the Write Single Coil (0x05), Write
Single Register (0x06), Write Multiple Coils (0x0F), or
Write Multiple Registers (0x10) Modbus commands. A trigger
can be defined that will execute whenever the Modbus Server
processes any of these commands or when it processes a
specific write command. The Modbus Server
Write trigger event is found under the PLC Logic Events
category of trigger event types.
Modbus Server Write event type trigger
To define a trigger that executes when a Modbus
Server Write occurs, select the Modbus
Server Write trigger event type. The
Event tab becomes active with parameters
that accommodate the event type.
Modbus Server Write event type trigger parameters
Parameter | Description |
---|---|
Device Name | Select the name of the Modbus Server device to associate with the trigger. The trigger will execute only when this specific Modbus Server device receives a write command. |
Modbus Command | Select the Modbus write command that
will execute the trigger:
|
Modbus Server Write event type trigger event variables
When the Modbus Server Write event type trigger executes, the Modbus write command information is available to the trigger as Input event variables. The trigger event variables available to trigger actions that have input or source parameters are:
Event Variable | Data type | Description |
---|---|---|
Command | UINT1 | The Modbus write command that was received by the Modbus Server. |
Count of Items Written | UINT4 | The number of coils or registers that were written by the write command. This value will be 1 for the Write Single Coil and Write Single Register commands. |
Data | Binary | The data that was written in the Modbus Server, as specified in the Modbus write command. |
Device Name | String | The name of the Modbus Server device that was written to. |
IP Address or Port | String | The address of the Modbus client that sent the Modus write command. This will be an IP Address if the client is connected to the server via an Ethernet (Modbus/TCP) connection. This will be the serial port for Modbus RTU clients. |
Starting Address | UINT4 | For command values of 0x05 or 0x0F,
the array offset in the Coils
array. For command values of 0x06 or 0x10, the array offset in the Holding Registers array. This value will be zero-based even if the Modbus Server Start Address setting is set to One |