cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC Creator & Designer Software

DaHu_285096
Contributor II

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);

0 Likes
Reply
3 Replies
DaHu_285096
Contributor II

 I found the issue, the return type from GetTemperature should have been int32 and not uint32.

   

Converts to negative value fine now.

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor

This ap note seems to indicate need for a second polynomial for negative

   

temps -

   

 

   

www.cypress.com/

   

 

   

Regards, Dana.

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor

This ap note seems to indicate need for a second polynomial for negative

   

temps -

   

 

   

www.cypress.com/

   

 

   

Regards, Dana.

0 Likes
Reply