Yukiko Posted June 1, 2023 Report Share Posted June 1, 2023 Hello, I'm trying to send 15 registers of data via Modbus 485 but each register should have 16 bits unsigned, the MI are signed, Any suggestion without having to use a lot of MB? Regards Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted June 1, 2023 MVP 2023 Report Share Posted June 1, 2023 The Modbus protocol is blind to whether something is signed or not. All type 4x Holding registers are 16 bit words. Explain further what you're trying to do - what is the device you're sending to expecting in the sign bit location? You can also do some tricks with unsigned DW data types. The Modbus protocol will break them into 16 bit chunks to send them. Joe T. Link to comment Share on other sites More sharing options...
Yukiko Posted June 1, 2023 Author Report Share Posted June 1, 2023 The Samba PLC is going to be a slave ModbusRTU connected to a gateway iot that works via comm rs485. And they ask me if i can make the next arrange: All modbus registers will be type “16-bit unsigned Holding Register” and will use the standard ModBus big endian notation Inside PLC Samba Modbus Register Type R/W Value Desired BOOL 1 Number R 0,1 BOOL 2 Number R 0,1 BOOL 3 Number R 0,1 BOOL 4 Number R 0,1 BOOL 5 Number R 0,1 BOOL 6 Number R 0,1 BOOL 7 Number R 0,1 BOOL 8 Number R 0,1 BOOL 9 Number R 0,1 BOOL 10 Number R 0,1 MI 11 Number R 0 - 65535 MI 12 Number R 0 - 65535 BOOL 13 Number R 0,1 MI 14 Number R 0 - 65535 15 16 17 18 19 20 Link to comment Share on other sites More sharing options...
Fernando Castro Posted June 2, 2023 Report Share Posted June 2, 2023 17 hours ago, Yukiko said: Hello, I'm trying to send 15 registers of data via Modbus 485 but each register should have 16 bits unsigned, the MI are signed, Any suggestion without having to use a lot of MB? Regards MIs are not signed as @Joe Tauser said you could use it: the difference is on how you will use the data in the MI itself 0xFFFF (65535) is interpreted as -1 decimal, from 0 to 32767 range is 0 to 32767. from 32768 to 65538 is -32767 to -1. so, if you will use the value in a math operation or in a counter and it happen to be bigger than 32767 then you need to store the value on an ML or do some math to shift the range but the binary value it will still be the same. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now