Anonymous

Project:HM55B: Difference between revisions

From London Hackspace Wiki
Line 240: Line 240:


In the example:
In the example:
 
<pre>
x = 0b11111101101
x = 0b11111101101
y = 0b11111101111
y = 0b11111101111
 
</pre>
''The Hitachi HM55B chip on the Compass Module reports its x and y axis measurements in terms of microteslas (μT) in 11-bit signed values.''
''The Hitachi HM55B chip on the Compass Module reports its x and y axis measurements in terms of microteslas (μT) in 11-bit signed values.''


Since both most significant bits equal one, x and y are negative and we take the two's complement:
Since both most significant bits equal one, x and y are negative and we take the two's complement:
 
<pre>
11111101101
11111101101
00000010010
00000010010
00000010011
00000010011
 
</pre>
x = -19
x = -19
 
<pre>
11111101111
11111101111
00000010000
00000010000
00000010001
00000010001
 
</pre>
y = -17
y = -17


Anonymous user