This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LPSTK-CC1352R: HDC2080 temperature sensor data has no decimal places?

Part Number: LPSTK-CC1352R
Other Parts Discussed in Thread: HDC2080

Hi,

I am using dmm_154sensor_remote_display_oad_lpstk_app example program as base for my project. I notice that the HDC2080 temperature sensor data sent to the collector has no decimal places. I reviewed the code the HDC2080 temperature sensor is read to a float value. If I am not mistaken float size is 5.

lpstk.c

//get last temp
float Lpstk_getTemperature()
{
    return lpstkSensors.temperature;
}

Then at sensor.c the float is type cast to uint16_t, which is size 2 if I am not mistaken. So, maybe that is the reason the decimal places are removed. We, need the temperature decimal places. Is the reason for type cast to uin16_t is because at collector csf.c CUI_statusLinePrintf() can not print in float format?

sensor.c

static void readSensors(void)
{
#if defined(TEMP_SENSOR)
    /* Read the temp sensor values */
    tempSensor.ambienceTemp = Ssf_readTempSensor();
    tempSensor.objectTemp =  tempSensor.ambienceTemp;
#endif
#ifdef LPSTK
    Lpstk_Accelerometer accel;
    humiditySensor.temp = (uint16_t)Lpstk_getTemperature();
    humiditySensor.humidity = (uint16_t)Lpstk_getHumidity();

-kel

  • Hi

    I have tried to print a float with the CUI_statusLinePrintf() but not succeeded so this might be the reason for why the temperature is cast to uint16_t

    We will look into this in more detail to see if it is possible to use floats with this function.

    For the other part (not printing) it should be pretty straight forward to modify the code to transmit the float value over the air instead of just an uint16.

    BR

    Siri

  • Hi Siri,

    I modified the code to just send the raw temperature data to collector. Then perform the computation to convert the raw temperature data to Celsius at the Wifi capable board. This is resolved at my side.

    -kel