我在AD的单通道多次转换模式中想利用中断实现多次采样,采样一定次数后执行下一语句。可现在的问题是执行完中断里的最后一条指令后,无法跳出中断执行下一语句。急啊。有没有大侠给小弟指点一下!部分代码如下:void main(void){ P6SEL |= 0x01; // Enable A/D channel A0 ADC12CTL0 = ADC12ON+ADC12SHT0_8+ADC12MSC; // Turn on ADC12, set sampling time // set multiple sample conversion ADC12CTL1 = ADC12SHP+ADC12CONSEQ_2;//+ADC12SSEL_3; // Use sampling timer, set mode,SCLK selected ADC12IE = 0x01; // Enable ADC12IFG.0 ADC12CTL0 |= ADC12ENC; // Enable conversions ADC12CTL0 |= ADC12SC; // Start conversion __bis_SR_register(LPM4_bits + GIE); // Enter LPM4, Enable interrupts ...//等待采样后要执行的代码 ...}#pragma vector=ADC12_VECTOR__interrupt void ADC12ISR (void){ static unsigned char index = 0; switch(__even_in_range(ADC12IV,34)) { case 0: break; // Vector 0: No interrupt case 2: break; // Vector 2: ADC overflow case 4: break; // Vector 4: ADC timing overflow case 6: // Vector 6: ADC12IFG0 if(index<32) { sample_in[index++] = ADC12MEM0; // } else { __bic_SR_register(LPM4_bits); //ADC12CTL0 &= ~ADC12SC; ADC12CTL0 &= ~ADC12ENC; index = 0; break; } case 8: break; // Vector 8: ADC12IFG1 case 10: break; // Vector 10: ADC12IFG2 case 12: break; // Vector 12: ADC12IFG3 case 14: break; // Vector 14: ADC12IFG4 case 16: break; // Vector 16: ADC12IFG5 case 18: break; // Vector 18: ADC12IFG6 case 20: break; // Vector 20: ADC12IFG7 case 22: break; // Vector 22: ADC12IFG8 case 24: break; // Vector 24: ADC12IFG9 case 26: break; // Vector 26: ADC12IFG10 case 28: break; // Vector 28: ADC12IFG11 case 30: break; // Vector 30: ADC12IFG12 case 32: break; // Vector 32: ADC12IFG13 case 34: break; // Vector 34: ADC12IFG14 default: break; }}
此帖出自
小平头技术问答
一周热门 更多>