用通道0就可以,仿真后results的数值也在变化,换成通道1之后程序仿真后进不了中断,新手不懂啊
#include<msp430f149.h>
#define Num_of_result 8
static unsigned int results[Num_of_result];//保存转换结果
void main()
{
WDTCTL = WDTPW + WDTHOLD;
P6SEL |= BIT1;
ADC12CTL0 = ADC12ON + SHT0_8 + MSC;
ADC12CTL1 = SHP + CONSEQ_2;
ADC12MCTL0 = INCH_1;
ADC12CTL0 |= ENC;
ADC12IE = BIT1;
ADC12CTL0 |= ADC12SC;
_EINT();
while(1);
}
#pragma vector=ADC_VECTOR
__interrupt void ADC12ISR(void)
{
static unsigned int index=0;
results[index]=ADC12MEM1;
index=(index+1)%Num_of_result;
if((Num_of_result-1)==index)
_NOP();
} |