# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

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

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.

regards

Ahmed Tafesh

Message 1 of 5
(6,339 Views)
Solution
Accepted by tafish

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

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)

Message 2 of 5
(6,323 Views)
Solution
Accepted by TheQ

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

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.

Message 3 of 5
(6,316 Views)

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

Thanks alot frinde

its work.

Message 4 of 5
(6,287 Views)

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

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.

Message 5 of 5
(6,269 Views)