kallileo
Lifetime Supporting Member
I have a custom IO board with Modbus TCP server running on it.
Modbus function codes implemented are for reading discrete input and inputs registers as well as read/write single holding register and single coils.
I'm going to use Codesys as Modbus TCP client to poll the inputs cyclically every 100ms which is the default setting.
I don't see a point doing the same for writing to holding registers and coils (physical relays on the board) so I think it would better to write to a coil only when the mapped variable changes from 0 to 1 or from 1 to 0 and not write continuously.
There is a "Trigger" option in Codesys Modbus channel setup that can be set to "Rising edge" of another variable that triggers the write on the coil or holding register.
I'm just not sure when exactly and how to activate rising edge to write the coil.
I guess something similar is happening in HMI software when a numeric value is entered into a label and it is transferred to the PLC only when the value changes.
Modbus function codes implemented are for reading discrete input and inputs registers as well as read/write single holding register and single coils.
I'm going to use Codesys as Modbus TCP client to poll the inputs cyclically every 100ms which is the default setting.
I don't see a point doing the same for writing to holding registers and coils (physical relays on the board) so I think it would better to write to a coil only when the mapped variable changes from 0 to 1 or from 1 to 0 and not write continuously.
There is a "Trigger" option in Codesys Modbus channel setup that can be set to "Rising edge" of another variable that triggers the write on the coil or holding register.
I'm just not sure when exactly and how to activate rising edge to write the coil.
I guess something similar is happening in HMI software when a numeric value is entered into a label and it is transferred to the PLC only when the value changes.