Showing results for 
Search instead for 
Did you mean: 

How to read 16 bit register as signed integer in Modbus I/O Server

Go to solution

HI, I am using Labview 2011 . I am reading 16bit holding register from other PC using Modbus.But the option is there only to read "16bit holding register as unsigned integers ranging from 0 to 65,535 " .


" But how to read it as signed integers , as some values from registers can have negative values".If read as unsigned integers the values are wrong. Is there a way to convert unsigned integers to signed integers.



Ahmed Tafesh

0 Kudos
Message 1 of 5
Accepted by tafish

Yes, you can do the conversion... just be careful not to change to value or round out something you need in the conversion process. 

From the block diagram, Functions Pallet -> Programming -> Numeric -> Conversion

Try the I16 or the FXP. The I16 is a direct conversion so you can't really control how it gets converted. The FXP you can right click and go to properties to do some conversions. 


If all else fails, you can do the U16 to Binary to FXP to I16. It may be the long way to get there but it should work. 


R^2 (Ryan)

0 Kudos
Message 2 of 5
Accepted by TheQ

Yes, that is a very long way to go.


All you need is the typecast function with an I16 constant wired in as the dataype.


0 Kudos
Message 3 of 5

Thanks alot frinde

its work.

0 Kudos
Message 4 of 5

I think if you use the information in Ryan's message, you'll have problems whenever the value is actually negative.


I suggest you try my solution instead using the typecast function.  I've used it numerous times with Modbus communication and I know it works.

0 Kudos
Message 5 of 5