Changes

no edit summary
Line 342: Line 342:  
|-  
 
|-  
 
|}
 
|}
 +
 +
==Converting Latitude and Longitude values to decimal==
 +
Latitude and Longitude values are being sent in HEX format, but to correctly parse them conversation from <b>HEX</b> to <b>Double</b>. Example:<br>
 +
The received value in HEX is 404B59A74E8E028D<br>
 +
<ol>
 +
<li>Convert the hexadecimal value to binary. The hex value <b>404B59A74E8E028D</b> can be converted to binary as <b>0100000001001011010110011010011101001110100011101110000001010001101</b>. </li>
 +
 +
<li>Determine the sign bit. The sign bit is the leftmost bit of the binary representation. A value of 0 indicates a positive number, while a value of 1 indicates a negative number. </li>
 +
 +
<li>Determine the exponent. The exponent is the next 11 bits after the sign bit. Subtract 1023 from the exponent value to obtain the actual exponent. In our example, the exponent bits "10000000100" correspond to the exponent value of 1028 (i.e., 2^10 + 2^3 = 1024 + 8 = 1032, and 1032 - 4 = 1028, since the bias for double precision is 1023). </li>
 +
 +
<li>Determine the significand. The significand is the remaining 52 bits after the sign bit and exponent. Add an implicit leading 1 to the significand to obtain a value between 1 and 2. In our example, the significand bits 0101101001110100011101010111010011100110000000010 correspond to a significand value of 1.3582693302319776. </li>
 +
 +
<li>Calculate the final value. The final value is determined by combining the sign bit, exponent, and significand according to the IEEE 754 standard for double-precision floating-point numbers. The formula is: (-1)^signbit x significand x 2^(exponent-1023). In our example, the final value is (-1)^0 x 1.3582693302319776 x 2^(1028-1023) = 54.7004183. <br>
 +
Therefore, the hexadecimal value 404B59A74E8E028D is equivalent to the double-precision floating-point value of approximately <b>54.7004183</b>. </ol>
 +
 +
[[File:HexToDecimal.png]]
 +
    
==CRC-16 calculation==
 
==CRC-16 calculation==

Navigation menu