I need to divide an Integer by 2048 and display as a decimal
Posted: Mon Jan 25, 2016 1:00 am
Hi,
I am sampling an accelerometer and placing the result in an integer (AccelMax).
The accelerometer represents 0 G's as 0 counts, and 16 G's as 32767 (2048 counts per G)
If I just divide the integer (AccelMax) by 2048, it rounds it off down to the nearest whole integer. I need to be able to show at least 2 decimal places. I'm not sure where to go from here. Any help is appreciated. Thanks.
Richard
I am sampling an accelerometer and placing the result in an integer (AccelMax).
The accelerometer represents 0 G's as 0 counts, and 16 G's as 32767 (2048 counts per G)
If I just divide the integer (AccelMax) by 2048, it rounds it off down to the nearest whole integer. I need to be able to show at least 2 decimal places. I'm not sure where to go from here. Any help is appreciated. Thanks.
Richard