Community discussions

MikroTik App
 
ecdc
just joined
Topic Author
Posts: 4
Joined: Fri Dec 08, 2023 4:33 pm

KNOT Modbus Meanwell

Fri Dec 08, 2023 4:46 pm

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!
 
User avatar
sirbryan
Member
Member
Posts: 417
Joined: Fri May 29, 2020 6:40 pm
Location: Utah
Contact:

Re: KNOT Modbus Meanwell

Thu Dec 21, 2023 1:38 am

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.
 
User avatar
DenSyo77
newbie
Posts: 27
Joined: Tue Jan 09, 2024 10:38 am
Contact:

Re: KNOT Modbus Meanwell

Wed Jan 10, 2024 2:17 pm

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
 
brambo123
just joined
Posts: 16
Joined: Sun May 11, 2014 1:39 pm

Re: KNOT Modbus Meanwell

Wed Jan 10, 2024 8:14 pm

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.
 
User avatar
DenSyo77
newbie
Posts: 27
Joined: Tue Jan 09, 2024 10:38 am
Contact:

Re: KNOT Modbus Meanwell

Thu Jan 11, 2024 11:46 am

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.
 
ecdc
just joined
Topic Author
Posts: 4
Joined: Fri Dec 08, 2023 4:33 pm

Re: KNOT Modbus Meanwell

Thu Jan 11, 2024 12:52 pm

@brambo123 thank you! It's alive!

Now to figure out how to process and email the values...
 
User avatar
DenSyo77
newbie
Posts: 27
Joined: Tue Jan 09, 2024 10:38 am
Contact:

Re: KNOT Modbus Meanwell

Thu Jan 11, 2024 2:03 pm

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