⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test44x_adc12_03.c

📁 430例程大全 端口操作 时钟模块FLL+操作 flash读写操作 看门狗操作 timerA-操作 timerB-操作 比较器A操作 基本定时器LED&LCD操作 ADC&BT&LC
💻 C
字号:

#include          "msp430x44x.h" // Standard Equations

static unsigned int results;            // Needs to be global in this example
                                        // Otherwise, the compiler removes it
                                        // because it is not used for anything.

void main(void)
{ 
  WDTCTL = WDTPW+WDTHOLD;               // Stop watchdog timer
  P6SEL |= 0x01;                        // Enable A/D channel A0
  ADC12CTL0 = ADC12ON+SHT0_15;          // Turn on ADC12, set sampling time
  ADC12CTL1 = SHP;                      // Use sampling timer, set mode
  ADC12IE = 0x01;                       // Enable ADC12IFG.0
  ADC12CTL0 |= ENC;                     // Enable conversions
  _EINT();                              // Enable interrupts  

  while(1)
  {
  ADC12CTL0 |= ADC12SC;                 // Start conversion
  _BIS_SR(LPM0_bits);                   // Enter LPM0 
   }
}

interrupt[ADC_VECTOR] void ADC12ISR (void)
{
  results = ADC12MEM0;                  // Move results, IFG is cleared
  _BIC_SR_IRQ(LPM0_bits);               // Clear LPM0, SET BREAKPOINT HERE
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -