LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

HI, I am using Labview 8.5.1 DSC Module . I am reading 16bit holding register from a device using Modbus I/O Server ( DSC Module).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, by using the scaling feature of shared variables.

 

regards

Santosh Kumar

 

0 Kudos
Message 1 of 5
(5,097 Views)
You could try using the typecast function to convert from the unsigned 16 bit (U16) to a signed 16bit (I16).
Message 2 of 5
(5,082 Views)

Hi,

 I want to know how to set it directly through Shared Variables property , so that the correct value gets stored into Citadel database.

 

 

regards

Santosh kumar

0 Kudos
Message 3 of 5
(5,064 Views)

Hi Santosh,

 

See if you can create the Shared variable itself as an I32. That way, it ll automatically write your data to the Citadel DB directly.

- Partha ( CLD until Oct 2027 🙂 )
Message 4 of 5
(5,061 Views)

When creating a shared variable for Modbus, there is a list of addresses that control how the data is read and formatted.  The ones with an S are signed.  Pick one of these when you create your variable.

 

Alternately, after you have created your variable change its format to signed, like Partha suggested.  It should work fine.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 5 of 5
(5,035 Views)