各位大大安安,我在函式中使用TIMER_Delay()延时函数,就无进不去TMR0_IRQHandler()中断函式了
注解掉TIMER_Delay()延时函数又行,想问其原因,谢谢!
- void TIMER0_Init(void)
- {
- SYS_ResetModule(TMR0_RST);
- TIMER_Open(TIMER0,TIMER_PERIODIC_MODE,1);
- TIMER_EnableInt(TIMER0);
- NVIC_EnableIRQ(TMR0_IRQn);
- TIMER_Start(TIMER0);
- }
- void TMR0_IRQHandler(void)
- {
- if(TIMER_GetIntFlag(TIMER0) == 1) {
- /* Clear Timer0 time-out interrupt flag */
- TIMER_ClearIntFlag(TIMER0);
- g_au32TMRINTCount[0]++;
- }
- }
- int main(void)
- {
- /* Unlock protected registers */
- SYS_UnlockReg();
- SYS_Init();
- /* Lock protected registers */
- SYS_LockReg();
- TIMER0_Init();
- while(1)
- {
- TIMER_Delay(TIMER0,1000000);
- PB5 = ~PB5;
- }
- }
复制代码 |