先看下面一段简易代码:
.......//子函数省略
void main
{
init();//各种初始化
while(1)
{
key_scan();//按键处理程序
}
}
//中断处理程序
void __attribute__ ((interrupt(ADC12_VECTOR))) ADC12ISR (void)
{
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
AD_dataA = ADC12MEM0;
AD_data_deal();//ad数据处理函数
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
default: break;
}
}
现在遇到的问题是,AD进入中断的频率太快了,以至于无法响应while(1)里面的按键处理程序,但是要是把AD的进入中断速率降低,采样速率又不能满足要求,,,请问该怎么办?
|