...
- Modbus TCP server scenario, which allows you to use 3d-party Modbus clients to send function code commands to the KNOT's IP address using Modbus TCP/IP connection (TCP port 502). You can use any Modbus Client software (there are plenty on the internet) or it can be easily written/configured in Python. In this case, the KNOT "translates/bridges" Modbus TCP/IP requests to Modbus RTU.
- Modbus RTU controller scenario (available only starting with v7.10beta510), which allows you to send function code commands directly from the RouterOS command line via Modbus/RTU.
...
Once the board is connected to the Modbus device, the only thing that needs to be altered/checked in the settings is the "Modbus" port configuration:
|
By default, a port with the name "modbus" is assigned to the Modbus service, but the service itself is disabled. In order to activate the "Modbus" service, you need to issue the command, as shown below:
|
Additionally, when you want to allow Modbus clients to communicate with the Modbus server using TCP(502)/IP protocol, you need to make sure that the IP address is configured accordingly and that this IP+502 TCP port is accessible from the outside (in case "slave" devices are connecting from the WAN side). You can find information on how to configure the firewall using the firewall manual.
...
Info |
---|
Available only starting with v7.10beta510. |
Sub-menu: /iot modbus transceive
Property | Description |
---|---|
address (integer:0..255; Default: ) | Specify device address or unit ID. |
function (integer:0..255; Default: ) | Specify the function code. For example:
|
data (string, max length 504; Default: ) | Input data string that usually specifies register address and data to be sent. For example:
The data string is 4 bytes long. "0x2000" is the command to the register (2 bytes long) and "0x0001" (2 bytes long) is the device's address. See the Modbus device's specifications for the exact data string that needs to be sent. |
values (integer:0..4294967295; Default: ) | An alternative way to send the data (see data parameter above). In this case, each value specified represents 1 byte of the data payload/string. For example:
Equals to the output of data=20000001. 32(dec)=0x20(hex), 0(dec)=0x00(hex), 0(dec)=0x00(hex), 1(dec)=0x01(hex) → 0x20000001. |
An example of sending function code 3 command using the "transceive" feature:
...