Tab: Modbus Server Channel
You use this tab to define server channels.
Each channel represents a single Modbus request.
Add Channel | Opens the Modbus Channel dialog. Here you can create new channels for the current Modbus Server. In the device description file of the Modbus Server, you can predefine descriptions for individual Modbus registers or entire channels. |
Dialog: Modbus Channel
Name | A string that contains the name of the channel |
Access type |
|
Trigger |
|
Cycle Time (ms) | For Trigger = CYCLIC: Request interval Note: The request interval should be the same as or a multiple of the cycle time of the application. |
Comment | Description of the channel |
Offset | Start address where reading should start (value range 0–65535) |
Length | Number of registers to be read (for word access) or number of discrete inputs to be read (for bit access) |
Error handling | Defines what should happen to the data in case of a communication error
|
Offset | Number of the register to be written to (value range 0–65535) |
Length | Number of registers to be written to (= words) The value range of the parameter depends on function code. |
Reading of coils and discrete inputs / Writing of coils to overlapping register memory
The CODESYS MODBUS I/O driver allows for the reading of coils and discrete inputs, as well as the writing of coils to overlapping register memory (the Discrete Bit Areas check box not selected). In this case, the first 8 bits which are read (%IB0) or written align with the high byte of the corresponding register. The second 8 bits which are read (%IB1) align with the low byte of the corresponding register (LSB first).
In the following example, the first line defines a combined read/write operation (function code 23). It reads a word from the "holding register" with offset 16#0001
and writes two words to the register with offset 16#0003
. The operation is performed as soon as the trigger variable defined on the I/O Mapping tab shows a rising edge.

