Unusual floating point data format

A

Thread Starter

Amit

Hi All,

I am trying to read metering data from Deif MTR-2-315 power transducer using Modbus RS485-RTU two wire connection. A Siemens S7-200 PLC acts as a master on this network. I have no problem reading voltage, current, KW, and KVAR values, which are in IEEE 754 floating point format. However Frequency and Power Factor are in some different data format. The data format is as follows:<pre>
Frequency (unsigned 32 bit measurement)
-----------------------------------

Bits #31...24 Decade Exponent (signed 8 bit)
Bits #23...00 Binary unsigned value (24 bit)

Power Factor (32 bit)
---------------------

Bits #31...24 Sign: Import/Export (00/FF)
Bits #23...16 Sign: Inductive/Capacitive (00/FF)
Bits #15...00 Unsigned value (16 bit), 4 decimal places


The binary data for frequency is as follows:


Register Address Bytes

30051 Byte #1 = 1111 1101

Byte #2 = 0000 0000

30052 Byte #1 = 1110 1010

Byte #2 = 0101 1110</pre>
Since the frequency data type looks very close to the standard IEEE floating point format. I tried to combine the two bytes at address 30052. After combining the two bytes, I could get value of 5999, which looked logical. I could also figure out that if I leave the sign bit off (1 at the beginning of Byte#1 at address 30051), the resulting decimal number comes out to be 125. And as per the standard floating point notation if I subtract 127 (which is the bias) from 125 I get -2, which means if I multiply the mantissa (5999) by 1/100 (10^-2) I should get 59.99. However, I am struggling as how to combine all four bytes in a PLC program so that I arrive at the answer 59.99 or 0.85 in case of the power factor. I tried using double integer to real conversion instruction, but it did not work. If I combine the two registers at the address 30051 and 30052, it gives me a 10 digit decimal number. Swapping and then combining the registers also results in a 10 digit decimal number.

Thanks in advance for the help.
 
I must be missing something here. Why do you think the frequency is any form of floating point? It even says "unsigned 32 bit".

When the bits for both registers at 30052 are combined, (1110 1010) and (0101 1110), the result is 1110 1010 0101 1110, or 1110101001011110 without the spaces.

That converts to 59998 (decimal), which is presumably the frequency value 59.998 (decimal) without the decimal point.

The decimal point is frequently assumed to be a fixed value for integer data. In this case, the contents of 30052 is an unsigned, 32 bit long integer with an assumed 3 digit decimal point.

Read 30052 and multiply by 0.001 to get your desired result.
 
Top