LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i convert floating point values to unsigned 16-bit integer value??

I have an application were in i acquire sensor data to labview and apply DSP algorithms to obtain floating point values. i need to convert floating point values to unsigned 16-bit integer values.I need the unsigned data values to communicate with MIL-STD-1553 bus. Any help would be appreciated.

 

 

Regards,

Manjunath Kamasani

Regards,
KM
0 Kudos
Message 1 of 6
(13,138 Views)

@kamasani wrote:

I have an application were in i acquire sensor data to labview and apply DSP algorithms to obtain floating point values. i need to convert floating point values to unsigned 16-bit integer values.I need the unsigned data values to communicate with MIL-STD-1553 bus. Any help would be appreciated.


You can consider converting floating point values to fixed point value (refer to link-1 & link-2 and then to 16-bt integer.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 2 of 6
(13,129 Views)

This link might also be of interest for you.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 3 of 6
(13,127 Views)

Hi

 

 Floating point numeric values can be converted to unsigned 16-bit integer values using the function "To Unsigned Word Integer Function" in the Conversion VIs and Functions subpallette. This subpallette is part of Numeric function pallette. check help to see whether it meets your req.

 

______________________________________________
Kudos are welcome
0 Kudos
Message 4 of 6
(13,121 Views)

@Gogineni wrote:

Hi

 

 Floating point numeric values can be converted to unsigned 16-bit integer values using the function "To Unsigned Word Integer Function" in the Conversion VIs and Functions subpallette. This subpallette is part of Numeric function pallette. check help to see whether it meets your req.


This conversion will led to data loss, I think OP wants to maintain the precision (to some extent) and is looking to convert the floating point number to integer, so that it can be sent over MIL bus.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 5 of 6
(13,117 Views)

There is no right answer to such a vague request. Conversion of a float to an integer will always result in loss of precision, range or both. The question is what loss is desired/acceptable. If the decimal part of the numeric value should be maintained, then the To Unsigned Word Integer conversion is right. Typically however the uint16 maps its values to some range, such as 0-2.25 A. Then you would have to do a scaling of the value similar to

 

uint16val = value / 2.25 * 65535

 

The last number is simply the maximum range value that the uint16 can assume. If less bits of the uint16 are relevant for the value (it could be for instance 15 bits and the highest bit is effectively a direction bit) then that value would have to be changed accordingly (2^15 -1 = 32767) and of course put correctly into the 16 bit integer using boolean operators with the right mask.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 6 of 6
(13,103 Views)