Hello all,
since I have no luck in another thread (https://community.nxp.com/message/764698), I want to ask my question in a different way.
I do use an LPC11U68 on an Xpresso V2 Rev C
The data sheet and manuals say that there is an 12bit ADC.
The internal temperature sensor is connected to channel 0 when powered up.
The sensor measures the temperature inverse to the ADC value.
The temperature range is from -40 to 105°C.
I get a raw ADC value of about 650.
So I calculate:
const constexpr std::int32_t maxRawValue = 4095; //12bit ADC
const constexpr std::int32_t temperatureRange = 145;
const constexpr std::int32_t temperatureOffset = 40;
const std::int32_t rawValue = getRawValue();
const std::int32_t invertedRawValue = maxRawValue - rawValue;
const std::int32_t result = (invertedRawValue * temperatureRange / maxRawValue) - temperatureOffset;
My result is than -17.
When I use some coolant spray, the rawValue will not change much.
Does anybody have some suggestions what I could do wrong?
Thanks a lot!
PS: I get correct ADC values when I turn off the internal temperature sensor and do connect a potentiometer.
Solved! Go to Solution.
Hi Johanntaferl,
What the temperature formula you are using?
From the lpc11u68 datasheet, we can get that:
So, the temperature formula should be:
Vtemp= -2.36T+606;
=>T=(Vtemp-606)/(-2.36),
Take care, Vtemp should be mV.
Besides, in the code, please note the user manual mentioned points:
For an accurate measurement of the temperature sensor by the ADC, the ADC must be configured in single-channel burst mode. The last value of a nine-conversion (or more)
burst provides an accurate result.
After the Temperature Sensor is powered, it requires some time to stabilize and output a voltage that correctly represents the device temperature. A much shorter settling time
applies after switching the A/D converter to use the sensor output. Software can deal with both of these factors by repeatedly converting and reading the Temperature Sensor output
via the A/D converter until a consistent result is obtained.
Please also do the calibration of the temperature sensor in the code.
Please check these points, and test it again.
Wish it helps you.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
there is an example
Hello David,
I found the example "periph_temp", but it only prints the raw 12bit hex values from the ADC. I try to figure out how to translate these values to degree Celsius.
Did I miss another example, or the conversion?
Thanks,
Johann
Hi Johanntaferl,
What the temperature formula you are using?
From the lpc11u68 datasheet, we can get that:
So, the temperature formula should be:
Vtemp= -2.36T+606;
=>T=(Vtemp-606)/(-2.36),
Take care, Vtemp should be mV.
Besides, in the code, please note the user manual mentioned points:
For an accurate measurement of the temperature sensor by the ADC, the ADC must be configured in single-channel burst mode. The last value of a nine-conversion (or more)
burst provides an accurate result.
After the Temperature Sensor is powered, it requires some time to stabilize and output a voltage that correctly represents the device temperature. A much shorter settling time
applies after switching the A/D converter to use the sensor output. Software can deal with both of these factors by repeatedly converting and reading the Temperature Sensor output
via the A/D converter until a consistent result is obtained.
Please also do the calibration of the temperature sensor in the code.
Please check these points, and test it again.
Wish it helps you.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------