TI provide a code sample to read channel 6, the internal temperature sensor.
I've modified the code so you can see the actual temperature. My additions are marked by the comment // DH
#include <msp430x20x3.h>
#define ADCDeltaOn 31 // ~0.5 Deg C delta
static unsigned int LastADCVal; // holds ADC temperature result
void main(void)
{
BCSCTL2 |= DIVS_3; // SMCLK/8
WDTCTL = WDT_MDLY_32; // WDT Timer interval
IE1 |= WDTIE; // Enable WDT interrupt
P1DIR |= 0x01; // P1.0 to output direction
SD16CTL = SD16REFON +SD16SSEL_1; // 1.2V ref, SMCLK
SD16INCTL0 = SD16INCH_6; // A6+/-
SD16CCTL0 = SD16SNGL + SD16IE + SD16DF; // DH
_BIS_SR(LPM0_bits + GIE); // Enter LPM0 with interrupt
}
float temp; // DH
#pragma vector=SD16_VECTOR
__interrupt void SD16ISR(void)
{
if (SD16MEM0 <= LastADCVal + ADCDeltaOn)
P1OUT &= ~0x01; // LED off
else
P1OUT |= 0x01; // LED on
LastADCVal = SD16MEM0; // Store value
temp = (LastADCVal / 65535.0F) * 1200.0F; // DH convert to mV
temp /= 1.32F; // DH convert to K - see datasheet SD16_A
temp -= 273.15F; // DH convert to C
}
// Watchdog Timer interrupt service routine
#pragma vector=WDT_VECTOR
__interrupt void watchdog_timer(void)
{
SD16CCTL0 |= SD16SC; // Start SD16 conversion
}