- Fri Jan 07, 2011 6:43 am
#116818
i have an accelerometer who give me a value and with the line up i want transform value in acceleration value in G :
value send by accelerometer * quantum= acceleration value directly
512*0,00198= 1,01376 g that's terrestrial gravity
with this code i don't arrive to calcul temp 2
temp2 = temp2*0,00198;
error: invalid digit "9" in octal constant
i have change the equation in that
temp2 = temp2*(198/100000)
but when a look temp2 it's 0
delay_us(100);
temp = read(ACCXMSB); //read msb
temp2 = temp << 8; // temp2 = 16BITS = msb (8bits) and lsb (8bits)
temp2 |= read(ACCXLSB);
temp2 = temp2 >> 2; // Get rid of two non-value bits in LSB
// temp2 = temp2*(198/100000);
Serial.print("\t");
Serial.print("\t");
Serial.print(temp2);
all work good without this line temp2 = temp2*(198/100000);
that show 512 as value
how can resolve this problem please and happy new year every boby!
value send by accelerometer * quantum= acceleration value directly
512*0,00198= 1,01376 g that's terrestrial gravity
with this code i don't arrive to calcul temp 2
temp2 = temp2*0,00198;
error: invalid digit "9" in octal constant
i have change the equation in that
temp2 = temp2*(198/100000)
but when a look temp2 it's 0
delay_us(100);
temp = read(ACCXMSB); //read msb
temp2 = temp << 8; // temp2 = 16BITS = msb (8bits) and lsb (8bits)
temp2 |= read(ACCXLSB);
temp2 = temp2 >> 2; // Get rid of two non-value bits in LSB
// temp2 = temp2*(198/100000);
Serial.print("\t");
Serial.print("\t");
Serial.print(temp2);
all work good without this line temp2 = temp2*(198/100000);
that show 512 as value
how can resolve this problem please and happy new year every boby!
You do not have the required permissions to view the files attached to this post.