3 Replies Latest reply on Dec 23, 2014 7:34 PM by user_14586677

    RTD to Temperature API

    user_343349849

      I note in the example that the RTD_GetTemperature() API returns a 32 bit unsigned int.

         

      I have written code based on the example and find that I cannot display values below 0. Casting the int as a foat does not convert the negative (I assume 2's complement) value into the appropriate negative temperature value.

         

      Is there a convenient conversion or do we need to manually do a 2's complement on the resistance value?

         

      rtdRes = (rtdVoltage * CAL_REF_RESISTOR / rtdCalVoltage) * 1000;  //convert to mOhms

         

      rtdTemp = RTD_GetTemperature(rtdRes);    //Returns 2's complement value when rtdRes < 100,000 mOhms (PT100)

         

      tempdisp = (float) (rtdTemp/100.0);

         

      sprintf(strbuf,"%3.2f%c",tempdisp,13);

         

      RS232_PutString(strbuf);