RTD to Temperature API | Cypress Semiconductor
RTD to Temperature API
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);