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.

MSP430F5529;ADC設定問題

Other Parts Discussed in Thread: MSP430F5529

大家好 我正在學習MSP430F5529

參考電位使用VCC 其他採用頻率數據暫時不管主要是ADC可動作

參照說明書 ADC12ENC = 1 & ADC12SC=1 & SHS0=0;應該就啟動ADC轉換但SAMPCON一直等於0 未轉換

附上影片請問是哪裡設置有誤??

//#include <msp430.h>
#include <msp430f5529.h>
#include <stdio.h>
int ad_value=0;
int main(void)
{
P6DIR=0x00;
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
ADC12CTL0 = ADC12SHT0_2 | ADC12ON ;
ADC12CTL1 = ADC12CSTARTADD_0 | ADC12DIV0 | ADC12CONSEQ_0 | ADC12SHS_0 | ADC12SSEL_2;//| ADC12SHP
ADC12MCTL0 = ADC12SREF0 | ADC12INCH0;

while(1)
{
ADC12CTL0 |= (ADC12ENC+ADC12SC) ;
ad_value=ADC12MEM0;
}
return 0;
}

  • 建议您参考一下TI的例程

    int main(void)
    {
      WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
      ADC12CTL0 = ADC12SHT02 + ADC12ON;         // Sampling time, ADC12 on
      ADC12CTL1 = ADC12SHP;                     // Use sampling timer
      ADC12IE = 0x01;                           // Enable interrupt
      ADC12CTL0 |= ADC12ENC;
      P6SEL |= 0x01;                            // P6.0 ADC option select
      P1DIR |= 0x01;                            // P1.0 output
    
      while (1)
      {
        ADC12CTL0 |= ADC12SC;                   // Start sampling/conversion
        
        __bis_SR_register(LPM0_bits + GIE);     // LPM0, ADC12_ISR will force exit
        __no_operation();                       // For debugger
      }
    }

  • www.ti.com/.../slac300
    使用官方提供的例子做参考吧,你可能使用的寄存器名跟该芯片的不符。看你启动使用的跟例子中使用的寄存器操作不一样。