How to read 32 bit floating point with flexy

We are trying to read 32-bit floating point that is split into two separate Modbus addresses. I am not sure how we can read the value of two address using Flexy? Do we need some Basic programming to accomplish this?

Hello @Maryam,

Reading floats with modbus on the flexy is fairly simply. When creating the tag you will need to add a modifier after the register number to specify the data type. This will tell the Flexy to read two addresses and combine them as specified.

Deryck

OK, I’m reading floats in successfully but they just started going over 1 million and now they only show in exponential form (i.e. 1,006,651.01 shows as 1.00665e+06). How do I show the whole number? I have this value getting put into a .csv file and emailed out every day and they can’t use the exponent form (it’s for a flow total value so least significant digits are important). Thanks, Nathan

I think this may be because we are using ieee 32 bit float. We’re limited to 7 digits because of the mantissa

image

Basically with the 32 bit float you have 23 bits that will act as the actual number which maxes out at 7 digits

image

There shouldn’t be any problem using IEE-754 to represent that size number. From the standard:

Conversion:

The value of a IEEE-754 number is computed as:

(sign) 2^exponent * mantissa

The sign is stored in bit 32. The exponent can be computed from bits 24-31 by subtracting 127. The mantissa (also known as significand or fraction) is stored in bits 1-23

My AB CompactLogix uses the same standard as well as my Panelview screens and they are showing it correctly. Is this just a rounding quirk in the firmware?

Hi,

Sorry for the confusion, could you try and read it in as a double precision float and see if it exports correctly? It seems like there’s currently a rounding issue with our double precision floats displaying internally but exporting should be fine.

Topic closed due to inactivity.