FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
964 views 0 comments
by anonymous

Hi, 

I´m trying to convert RUT955 GPS variables using modbus as described in the https://wiki.teltonika.lt/view/Monitoring_via_Modbus guide. 

I get two decimal values using modbus read   -p 502 192.168.1.1 %MW143 2 but I´m unable to convert these values into a latitude xx.xxxx value.

Any help on this matter would be appreciate it, thanks in advance,

1 Answer

+3 votes
by

I found the solution to this, hope it may be useful to someone else.

The architecture of this number format is the following:

S E F
0 1_______8 9_______________________31


S: sign
E: exponent
F: faction (also referred to as the mantissa or significand)

calculation would be = (-1)^S * 2^(E [dec format]-127) * (1.F)[Base 10]

Take the reading of RTU995 as an example. If the frequency reading in floating point registers are (
read -p 502 192.168.1.1 %MW143):

1020: 0100001001000111
1021: 0000000000000000

Combine 2 registers in binary format to become:
01000010010001110000000000000000

According to the IEEE Floating Point Standard, split the combined value according to the structure:
 

S E F
0 10000100 10001110000000000000000


When S=0, it is a positive number (i.e. S=1 means the value is negative).
The value in E is 10000100, which is 132 in decimal.
The remaining portion is placed in F, which is 0.10001110000000000000000 (Base 2).
1.F is 1.10001110000000000000000 in base 2, which equals to 1.55468750000000000000000 in Base 10
1.554687500000000000000001.55468750000000000000000
Placing this in the formula results in (-1)^(0) * 2^(132-127) * (1.55468750000000000000000) = 49.75

Best answer