Page 1 of 1

KNOT Modbus Meanwell

Posted: Fri Dec 08, 2023 4:46 pm
by ecdc
Hi folks, anyone used Modbus RTU and sucessfully polled from any device?

I'm really struggling to get anything from the Meanwell DRS device I'm currently working on, no matter what setting or configuration I cannot get a response.

Using latest RoS (7.13rc3)

Meanwell Manual states:

Baud Rate: 115200
Data Bits: 8
Stop Bits: 1
Parity: None
Flow Control: None

Which is matched in the port settings of the KNOT.

I have attempted to use the transceive command for RTU but everytime I receive "failure: Timeout"

Some of the commands I've tried are:

> iot/modbus/transceive address=3 function=4 values=80
> iot/modbus/transceive address=0x83 function=0x04 values=0050
> iot/modbus/transceive address=03 function=04 values=80

Slave ID being: 0x83 (Device Number)
Function Code: 0x04 (Read Input Register)
Register Address: 0x0050 (Read VIN)

Any advice or input would be very much appreciated!

Re: KNOT Modbus Meanwell

Posted: Thu Dec 21, 2023 1:38 am
by sirbryan
See this post: viewtopic.php?p=1043459#p1043459

Try swapping the A/B pins (+/-) between the DRS and KNOT. Also, I couldn't get the /iot/modbus/transceive commands to work, but using a TCP app to connect to the KNOT works just fine.

Re: KNOT Modbus Meanwell

Posted: Wed Jan 10, 2024 2:17 pm
by DenSyo77
Try this command
iot/modbus/transceive address=0x83 function=0x04 values=0,0x50,0,1

values=a,b,c,d
a - will be called function with number as sum (function + 128)
b - start register address
c - don't understand yet
d - number of registers

Re: KNOT Modbus Meanwell

Posted: Wed Jan 10, 2024 8:14 pm
by brambo123
Try this command
iot/modbus/transceive address=0x83 function=0x04 values=0,0x50,0,1

values=a,b,c,d
a - will be called function with number as sum (function + 128)
b - start register address
c - don't understand yet
d - number of registers
And now the real explanation:
a + b: start register address, 16 bit / 2 bytes length, in this example a = 0x00 b = 0x50
c + d: number of registers, 16 bit / 2 bytes length, in this example c = 0x00 d = 0x01

If I read the manual correctly, this is also possible:
iot/modbus/transceive address=0x83 function=0x04 data=00500001
In any case, the biggest problem is that you forget to indicate how many registers you want to read.

Re: KNOT Modbus Meanwell

Posted: Thu Jan 11, 2024 11:46 am
by DenSyo77
Thanks, brambo123! I'm tired of guessing :D
With my device (maybe it makes a difference), if pass (a) as non-zero value, then the function (passed function number + 128) will be called, this is probably the behavior of the device when accessing non-existent registers. Now it became clear to me why any (c) value causes an error.

Re: KNOT Modbus Meanwell

Posted: Thu Jan 11, 2024 12:52 pm
by ecdc
@brambo123 thank you! It's alive!

Now to figure out how to process and email the values...

Re: KNOT Modbus Meanwell

Posted: Thu Jan 11, 2024 2:03 pm
by DenSyo77
ecdc, iot/modbus/transceive address=0x83 function=0x04 values=0,0x50,0,1 - will also work, values=0,0x50,0,1 and data=00500001 is equal