Modbus RTU with Knot

Hello,

I’m new to Modbus RTU and want to get values of a SDM230-Modbus Single-Phase DIN rail Meter.
(https://stromzähler.eu/media/05/ae/19/1696582672/sdm230-modbus.pdf)

The ID of the energy-meter is set to 111.
Baud rate is set to 9600 on the Knot and energy-meter. Wired connection is correct, too.
Function should be Read Input Register (FC 4), I think.
I tested several commands like the following to get the value Active power in watts (register 30013):

iot/modbus/transceive address=111 function=3 values=30013
iot/modbus/transceive address=111 function=4 values=30013

But all the testing leads to “failure: Timeout”.

Can someone please help me or give me a hint to get the right command?

Kind Regards

It is the 30013 that is not correct, it is the address of the register, but not the Modbus address.

Seemingly there is a base address of 30001 (which corresponds to Modbus 0).

30013 becomes 000C (see page 15 of the pdf you posted a link to).

as a matter of fact 30013-30001=12 → 0x000C

The syntax should be something like:

/iot modbus transceive address=111 function=4 data=000C0002

(for some reasons that device seems to need an even number, so 1 register=02, 2 registers=04, etc.)

data is the actual hex string
values is a comma separated array of decimal values, check:
https://help.mikrotik.com/docs/pages/viewpage.action?pageId=61046813
using values, it would probably be:

/iot modbus transceive address=111 function=4 values=0,12,0,2

See also this thread:
http://forum.mikrotik.com/t/knot-modbus-rtu-write-registers/177356/1

great, thank you :slight_smile:
now it`s clear to me