- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found the issue, the return type from GetTemperature should have been int32 and not uint32.
Converts to negative value fine now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This ap note seems to indicate need for a second polynomial for negative
temps -
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This ap note seems to indicate need for a second polynomial for negative
temps -
Regards, Dana.