This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

关于MSP430G2的ADC10多通道采样的问题。看了一宿了,很累,但是在线等



我用ADC10的多通道采样模式采样信号,但是采样的结果都是0。看了一宿了,很累,但是在线等。先谢谢大家,帮帮忙,附上相关程序。

float adc_temp[8];
float IntDegu;
float IntDegi;
unsigned int IntDeg1;
unsigned int IntDeg2;

void GPIO_Init()
{
          P2SEL&=~(BIT6+BIT7);
        //  P1SEL |= BIT1+BIT0;
         // P1DIR &= ~(BIT1+BIT0);
          P1REN |= BIT3;
          P1IE |= BIT3;
          P1IES |= BIT3;
          P1IFG &= 0x00;
}

void ADC10_init(void)
{



    ADC10CTL0&=~ENC;
    ADC10CTL1=CONSEQ_1+INCH_1;
    ADC10CTL0=SREF_0+MSC+ADC10ON+ADC10IE;

    ADC10DTC1=0x02;
    ADC10AE0|=BIT0+BIT1;
    __delay_cycles(300000);
    ADC10CTL0&=~ADC10IFG;
    ADC10CTL0|=ENC;
}

#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR_HOOK(void)
{
          __bic_SR_register_on_exit(CPUOFF);
            IntDegu=14*11/(3*7)-3*adc_temp[1]/(3*1023);
          IntDegi=3/20-3*adc_temp[0]/(10230);

          IntDeg1=IntDegu/IntDegi;
          IntDeg2=23.3;
          DisplayRes();
          ADC10CTL0&=~ENC;
}

void main( void )
{
  WDTCTL = WDTPW+WDTHOLD;

  BCSCTL1 = CALBC1_12MHZ;  //设定cpu时钟DCO频率为12MHz

      DCOCTL = CALDCO_12MHZ;
  GPIO_Init();
  LcdReset();
  Lcd_Init();
  ADC10_init();

 while(1)
 {




      while(ADC10CTL1&BUSY);
      ADC10SA=(unsigned int)(adc_temp);
      ADC10CTL0|=ENC+ADC10SC;
      _BIS_SR(LPM0_bits+GIE);

         ADC10CTL0&=~ENC;




}
}