01-23-2014 07:31 AM
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
Solved! Go to Solution.
01-23-2014 08:22 AM
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)
01-23-2014 08:30 AM - edited 01-23-2014 08:31 AM
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.
01-24-2014 04:31 AM
Thanks alot frinde
its work.
01-24-2014 03:22 PM
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.