I am trying to decode the magnetic heading that is contained in a 10bit field. I am not sure how the above instructions are interpreted. What i did is just took the 10 bits and convert them to decimal like this
int magneticheading = Convert.ToInt32(olotoMEbinary.Substring(14, 10), 2);
But then i checked that 259degrees only need 9bits to be expressed in binary (100000011). I am confused about what does a most significant bit of 180 degrees mean and a lsb of 360/1 024 .
For example if i receive the following 10bits 0100001010 how are they converted to de开发者_如何学运维grees according to the above instructions?
Using floating-point math, multiply by 360 and divide by 1024.
The instructions the question references are missing, but Stephen Cleary's method appears to fit the two data points provided. It may help to think of it as a unit conversion from 1024 divisions of a circle to 360.
精彩评论