WWDG不能进中断

2019-08-14 19:44发布

        NVIC_InitTypeDef NVIC_InitStructure;
        LED_Init();
        Key_Init();
        RCC_APB1PeriphClockCmd(RCC_APB1Periph_WWDG,ENABLE);
        WWDG_SetPrescaler(WWDG_Prescaler_8); // 1098hz
        WWDG_SetWindowValue(0x5F);
        WWDG_ClearFlag();       
        WWDG_EnableIT();        
        NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
        NVIC_InitStructure.NVIC_IRQChannel = WWDG_IRQn;
        NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
        NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
        NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
        NVIC_Init(&NVIC_InitStructure);
        WWDG_Enable(0x7F);
程序没办法进中断一直复位,但是看门狗使能那一句改个位置就可以了,原因没找到,求学霸解答
        NVIC_InitTypeDef NVIC_InitStructure;        LED_Init();        Key_Init();        RCC_APB1PeriphClockCmd(RCC_APB1Periph_WWDG,ENABLE);        WWDG_SetPrescaler(WWDG_Prescaler_8); // 1098hz        WWDG_SetWindowValue(0x5F);         WWDG_Enable(0x7F);        WWDG_ClearFlag();                WWDG_EnableIT();                 NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);        NVIC_InitStructure.NVIC_IRQChannel = WWDG_IRQn;        NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;        NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;        NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;        NVIC_Init(&NVIC_InitStructure);改个位置就行了这是为什么。      
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。