#include  "msp430x12x2.h"
;******************************************************************************
;   MSP-FET430P120 Demo - ADC10 Sample A10 Temp Set P1.0 if temp > ~ 29c 
;
;   Description; A single sample is made on A10 with reference to internal
;   1.5V Vref. Software sets ADC10SC to start sample and conversion - ADC10SC 
;   automatically cleared at EOC. (ADC10OSC/4)/64 determines sample time which
;   needs to be greater than 30us for temperature sensor. In Mainloop MSP430 
;   waits in LPM0 to save power until ADC10 conversion complete, ADC10_ISR will
;   force exit from any LPMx in Mainloop on reti. If A10 > 1088mv, P1.0 set, 
;   else reset. A10 ~ 1088mv or 02E7h with 1.5v reference very approximate 29c.
;   Temperature sensor offset and slope will vary from device to device per 
;   datasheet tolerence. 
;   //* MSP430F1232 or MSP430F1132 Device Required*//
;
;                MSP430F1232
;             -----------------
;         /|\|              XIN|-  
;          | |                 |
;          --|RST          XOUT|-
;            |                 |
;            |A10          P1.0|-->LED
;
;   M.Buccini
;   Texas Instruments, Inc
;   January 2002
;******************************************************************************
;------------------------------------------------------------------------------ 
            ORG     0E000h                  ; Program Start
;------------------------------------------------------------------------------ 
RESET       mov.w   #0300h,SP               ; Initialize stackpointer
StopWDT     mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
SetupADC10  mov.w   #INCH_10+ADC10DIV_3,&ADC10CTL1 ; Temp Sensor ADC10CLK/4    
            mov.w   #SREF_1+ADC10SHT_3+REFON+ADC10ON+ADC10IE,&ADC10CTL0 ; 
SetupP1     bis.b   #001h,&P1DIR            ; P1.0 output
                                            ;
Mainloop    bis.w   #ENC+ADC10SC,&ADC10CTL0 ; Start sampling/conversion
            bis.w   #CPUOFF+GIE,SR          ; Hold, ADC12 ISR will force exit
            bic.b   #01h,&P1OUT             ; P1.0 = 0
            cmp.w   #02E7h,&ADC10MEM        ; ADC10MEM = A10 > 02E7h?
            jlo     Mainloop                ; Again
            bis.b   #01h,&P1OUT             ; P1.0 = 1
            jmp     Mainloop                ;
                                            ;
;------------------------------------------------------------------------------ 
ADC10_ISR;   
;------------------------------------------------------------------------------ 
            bic.w   #CPUOFF,0(SP)           ; Exit LPM0 on reti
            reti                            ;		 
                                            ;
;------------------------------------------------------------------------------ 
;           Interrupt Vectors Used MSP430x12x2         
;------------------------------------------------------------------------------ 
            ORG     0FFFEh                  ; MSP430 RESET Vector
            DW      RESET                   ; 
            ORG     0FFEAh                  ; ADC10 Vector
            DW      ADC10_ISR               ; 
            END
