SLAA398A September 2008 – August 2018 MSP430F4794 , MSP430F4794
The thermostat software is based on periodic one-second interrupts and a counter whose value increments from 0 through 6 to determine which of the processes (A, B, or C) should be executed. Because the LCD segments that are used to display the time and temperature are shared, the time is displayed for thee seconds and then the temperature is displayed for three seconds. The Basic Timer interrupt occurs to execute process A, the RTC function, and increment the count. If the count is 3, then process B is also executed to update the time on the LCD. If the count is 6, process C is also executed, during which the thermistor is sampled, temperature is calculated and displayed on the LCD replacing the time, and the count is reset to zero, completing the six-second cycle.
To obtain the temperature, the SD16 1.2-V reference is applied to the thermistor plus 47-kΩ series resistor combination, and the thermistor voltage is sampled via the SD16 to obtain a raw value. This raw value is then converted to a voltage by first subtracting 8000h from the result, because 8000h corresponds to a voltage level of 0 V. Next, this value is multiplied by the voltage step per bit, which is 1.2 V / (216 – 18 µV/bit.
Vthermistor = (RawValue – 8000h) × 18 µV/bit
Once the voltage is known, the resistance is determined by solving for the thermistor value that produces the measured thermistor voltage based on the voltage divider equation.
Vthermistor = Vref × (Rthermistor / (Rthermistor + 47 kΩ))
Rearranging the equation to solve for Rthermistor yields
Rthermistor = Vthermistor × (47 kΩ / (Vref – Vthermistor))
Once the thermistor resistance is known, a look-up table from the thermistor manufacturer’s data sheet is referenced to determine the corresponding temperature.