Jump to content

Registers of 16 bit unsigned via Modbus 485 Samba 3.5 VisiLogic


Recommended Posts

  • MVP 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

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

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:

 

image.thumb.png.cee51b117f579f429caf62e329d394c4.png

 

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.