#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; // Ena××e WDT interrupt
P1DIR |= 0x01; // P1.0 to output direction
SD16CTL = SD16REFON +SD16SSEL_1; // 1.2V ref, SMCLK
SD16INCTL0 = SD16INCH_5; // the power v
SD16CCTL0 = SD16SNGL + SD16IE ; // Single conv, interrupt
_BIS_SR(LPM0_bits + GIE); // Enter LPM0 with interrupt
}
#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
}