Search Results

Search found 1 results on 1 pages for 'mrigendra'.

Page 1/1 | 1 

  • Data conversion from accelerometer

    - by mrigendra
    Hi all I am working on an accelerometer bma220 , and its datasheet says that data is in 2's complement form.So what i had to do was getting that 8 bit data in any 8 bit signed char and done. the bma220 have an 8 bit register of which first 6 bits are data and last two are zero. void properdata(int16_t *msgData) { printf("\nin proper data\n"); int16_t temp, i; for(i=0; i<3; i++) { temp = *(msgData + i); printf("temp = %d sense = %d\n", temp, sense); temp = temp >> 2; // only 6 bits data temp = temp / sense; //decimal value * .0625 = value in g printf("temp = %d\n", temp); } } in this program i am taking data in a unsigned variable msgdata and doing all the calculations on a signed variable. I just need to know if this is the correct way to convert data?

    Read the article

1