The two 16-bit numbers provide the upper and lower halves of the 32-bit number. The following steps break down the attached VI.
- 16-bit numbers need to be joined using the Join Number function to create a 32-bit integer.
- Depending on the format your data and any other manipulations you would like to do, you may need to use the Swap Words function to obtain the correct value.
- You can then set the integer is then sent to the Type Cast function to designate the correct format representation.
- Set the data type to be cast to by wiring in a Numeric Constant to the top of the Type Cast function. Next, right-click on the Numeric Constant, go to Representation, and select SGL.
The picture below shows a simple example of how to do the conversion using arbitrary data. Keep in mind you may not need to use the Swap Words function depending on your data format. We only show it below to demonstrate how to use it.
Additional Information
This operation is not necessary if you are using the Modbus IO Server since it already handles this case with the use of F addressing. See the
Using Modbus I/O Servers manual for more information on how to do so. The floating point value may have to be swapped depending on your device. See the
How to Swap Registers for Modbus Floating Point Values article for details on more information on this topic.