Knowledge Base / Gateways / QuickServer

How does field server modbus driver handle floats

Search KB

Kategorien

When dealing with floats and modbus in a field server product, there are a few key elements to be aware of. First, if the data array you are connecting with your modbus point is of type Float, the field server will convert the value to an integer (stripping off the mantissa/fraction such that 12.34 would become just 12) and transfer that. If you're getting integer values from your other protocol, even though they're being stored in a 32 bit floating value (common for BACnet for instance) this means no conversion is necessary for you, the quick server will do the conversion for you.

However, if you wish to maintain the mantissa/fraction and send the full floating point value, additional steps will be necessary. Since modbus does not have any floating point register type, you will need to break down the floating point value into two separate integer values, and transfer those. To break down a floating point value, use the special move command function Split_Float. To recombine a floating point value transferred as separate integers, use the special move command function Join_Float. To swap the word order of floats when splitting or joining them, use Split_Float_Swapped and Join_Float_Swapped respectively.

Example Syntax would be:

Moves
Function , Source_Data_Array, Source_Offset, Target_Data_Array, Target_Offset, Length
Join_Float, Your_Integer_Array , 0 , Your_Float_Array , 0 , 2

Length is the number of floats created or disassembled.

For additional details on float conversion refer to page 23 and 24 of the Field Server Configuration Manual.