您好。我把程序改成以下这样,去了中断,当把P1.1引脚加VCC的时候等还是不灭
#include "msp430g2231.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
ADC10CTL0 = SREF_0+ADC10SHT_3+ADC10ON + REFON; //选VCC为基准,16xADC10CLKS,ADC10 开,基准开
ADC10CTL1=INCH_1+CONSEQ_0+ADC10DIV_1+ADC10SSEL_2;//选通道A1,2分频,MCLK
ADC10AE0 |= BIT1 ; //选择通道A1
P1DIR |= BIT0;
while(1)
{
ADC10CTL0 |= ENC + ADC10SC; //选转换使能+开始转换
if (ADC10MEM < 0x1FF)
P1OUT &=~ BIT0; //off
else
P1OUT |=BIT0; //on
}
}
谢谢您。