Pages: [1]   Go Down
Author Topic: BMA180 MSB and LSB  (Read 439 times)
0 Members and 1 Guest are viewing this topic.
United States
Offline Offline
Full Member
***
Karma: 0
Posts: 104
Indubitably
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can anyone verify that this is correct? The msb register is 8 bits and the lsb is the first 6 bits of another register.
Code:
int rawData = ((msb << 8) | lsb) >> 2;

This code is oversimplified for clarity btw.
Logged

fuzzball27 >>-->

Offline Offline
Edison Member
*
Karma: 17
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

if lsb is 2 bytes trash then 6 bytes good data, you just want to do this:
Code:
int rawData = (msb << 6) | lsb;

if it's 6 bytes good data, then 2 bytes trash, your version is fine.
Logged

United States
Offline Offline
Full Member
***
Karma: 0
Posts: 104
Indubitably
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Awesome! Thanks smiley
Logged

fuzzball27 >>-->

Pages: [1]   Go Up
Jump to: