I am using a function to read the die temperature data from nRF51822 as follows:
static uint32_t temperature_data_get(void)
{
int32_t temp;
uint32_t err_code;
err_code = sd_temp_get(&temp);
APP_ERROR_CHECK(err_code);
temp = (temp / 4) * 100;
int8_t exponent = -2;
return ((exponent & 0xFF) << 24) | (temp & 0x00FFFFFF);
}
It seems to output a single-precison floating point number. I read the data from Nordic Master Control Panel Android app. The data is 0xFE000DAC (after byte order inversion because of the endianess), and is interpreted as 35.00 degree C. However, I have difficulty in getting this result after doing the single-precision floating point number conversion according to en.wikipedia.org/.../Single-precision_floating-point_format and steve.hollasch.net/.../ieeefloat.html . I actually get a negative number as a result of two's complement. Can anyone please advise?