MSP430G2553使用電池供電時量測內部溫度
大家好,想請教一下各位前輩,最近在使用MSP430G2553製作一個低功耗溫度發射器。遇到當我使用2節5號電池供電時,內部溫度計量測出來的溫度都會出現負幾萬度,不正常的數值。
但是當我使用USB供電時,卻是能正確地顯示出溫度。
以下是我的溫度量測程式碼
float readTemperature() {
FValue1000 = 0;
for (int count = 0; count < Temp_Gain; count++)
{
ADC10CTL0 = SREF_1 + REFON + ADC10ON + ADC10SHT_3;// use internal ref, turn on 1.5V ref, set samp time = 64 cycles
ADC10CTL1 = INCH_10 + ADC10DIV_3; // Temp Sensor ADC10CLK/4
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
sensorValue = ADC10MEM; // store the ADC10 value
FValue=(((sensorValue) - 630) * 761) / 1024; // do math on ADC10 value to convert to degrees F
FValue1000 = FValue1000 + FValue; // store value (this is how we can apply gain to the measurement)
}
FValue1000 = (FValue1000/Temp_Gain); // do gain error
FValue1000 = FValue1000 + Temp_Offset;// do offset error
return (((FValue1000-32)*5)/9);
}我也有嘗試過使用1.5V內部參考,但是出來的數值還是不正確
看看学习
页:
[1]