请问有没有MSP430F4793 内部温度传感器的 使用例程,十分感谢!!
gaoyang9992006:
#include <msp430.h>unsigned int ADCresult; unsigned long DegC = 0; unsigned long DegF = 0;int main(void) {volatile unsigned int i;// Use volatile to prevent removal// by compiler optimizationWDTCTL = WDTPW + WDTHOLD;// Stop WDTFLL_CTL0 |= XCAP11PF;// Configure load capsfor (i = 0; i < 10000; i++);// Delay for 32 kHz crystal to// stabilizeSD16CTL = SD16REFON+SD16SSEL0;// 1.2V ref, SMCLKSD16CCTL2 |= SD16SNGL+SD16IE ;// Single conv, enable interruptSD16INCTL2 |= SD16INCH_6;// Select Channel A6for (i = 0; i < 0x3600; i++);// Delay for 1.2V ref startupwhile (1){SD16CCTL2 |= SD16SC;// Set bit to start conversion__bis_SR_register(LPM0_bits + GIE);// Enter LPM0 w/ interruptsDegC = ((unsigned long)ADCresult * 909)/65536 - 727;// Calculate degrees CelciusDegF = ((unsigned long)ADCresult * 1636)/65536 - 1276;// Calculate degrees Farenheit__no_operation();//SET BREAKPOINT HERE} }#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=SD16A_VECTOR __interrupt void SD16AISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(SD16A_VECTOR))) SD16AISR (void) #else #error Compiler not supported! #endif {switch (SD16IV){case 2:// SD16MEM Overflowbreak;case 4:// SD16MEM0 IFGbreak;case 6:// SD16MEM1 IFGbreak;case 8:// SD16MEM2 IFGADCresult = SD16MEM2;// Save CH2 results (clears IFG)break;}__bic_SR_register_on_exit(LPM0_bits);// Exit LPM0 }
gaoyang9992006:
http://www.ti.com/cn/lit/zip/slac155
全部相关例程序从上面链接下载。