Hello,
For Modbus TCP, I use modbus_tcp_test
For Morbus RTU, I use the same thing after setting the Modbus Gateway function, which allows to translate the Modbus TCP request into Modbus RTU directly
Example
modbus_tcp_test 192.168.1.251 502 5 255 3 1 10 hex 1
Modbus TCP device (slave ID 255)
Reading from %MW1 to %MW10 on IP 192.168.1.251, Device ID 255, presentation of the result in hexa
In Modbus RTU, after configuration of the gateway
modbus_tcp_test 127.0.0.1 502 5 2 3 1 10 hex 1
Execute %MW1 %MW10 on the local address of the gateway, Modbus RTU slave ID 2, result in hex
root@Teltonika-TRB245:~# modbus_tcp_test -h
Usage:
modbus_tcp_test IP PORT TIMEOUT SLAVE_ID FUNCTION REG_ADDRESS REG_COUNT/VALUE(S) DATA_TYPE NO_BRACKETS
DATA_TYPE may be one of:
8bit_int
8bit_uint
16bit_int_hi_first
16bit_int_low_first
16bit_uint_hi_first
16bit_uint_low_first
32bit_float1234
32bit_float4321
32bit_float2143
32bit_float3412
32bit_int1234
32bit_int4321
32bit_int2143
32bit_int3412
32bit_uint1234
32bit_uint4321
32bit_uint2143
32bit_uint3412
hex
ascii