你好!我碰到一个PIT,ADC中断的问题,如下:
1. 单独开PIT0或者ADC中断的时候都很正常,PIT0的中断周期是1S,ADC采用的是软件开启,连续触发;
2. 两个中断同时打开,默认优先级,这时候只能进ADC中断;
3. 两个中断同时打开的时候,PIT的优先级为默认,ADC的优先级设为2(NVIC_SetPriority(ADC0_IRQn, 2);),运行大概5秒钟左右,就会死机,或者只有ADC中断,PIT中断进不去了。我中断服务程序里面都有关、开中断的操作。
服务程序:
void PIT_ISR(void)
{
NVIC_DisableIRQ(PIT_IRQn);
GPIO_ToggleBit(HW_GPIOC, 5);
count++;
//UART_WriteByte(HW_UART2,count);
NVIC_EnableIRQ(PIT_IRQn);
}
void ADC_ISR(void)
{
NVIC_DisableIRQ(ADC0_IRQn);
count2++;
UART_printf(HW_UART2,"ADC conversion result is :%d\n",ADC_ReadValue(HW_ADC0, kADC_MuxA));
UART_printf(HW_UART2,"PIT interrupt count is :%d\n",count);
UART_printf(HW_UART2,"ADC0 interrupt count is :%d\n",count2);
//NVIC_ClearPendingIRQ(ADC0_IRQn);
DelayMs(10);
NVIC_EnableIRQ(ADC0_IRQn);
}
求指教啊!谢谢!
|