Go Down

Topic: BMA180 MSB and LSB (Read 524 times) previous topic - next topic

fuzzball27

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: [Select]

int rawData = ((msb << 8) | lsb) >> 2;


This code is oversimplified for clarity btw.
fuzzball27 >>-->

WizenedEE

if lsb is 2 bytes trash then 6 bytes good data, you just want to do this:
Code: [Select]

int rawData = (msb << 6) | lsb;


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

fuzzball27

fuzzball27 >>-->

Go Up