|
关于PVD进中断请教香主和各位大哥,小弟刚学这个,程序想实现检测到电压低时(也就是要断电时),马上进中断做一些处理,可是下面我的配置得到的结果是开始跑程序就不停的进中断 主程序: PWR_PVDLevelConfig(PWR_PVDLevel_2V2); PWR_PVDCmd(ENABLE);
while(1) ``````
NVIC配置:
void NVIC_Configuration(void) { NVIC_InitTypeDef NVIC_InitStructure; #ifdef VECT_TAB_RAM /* Set the Vector Table base location at 0x20000000 */ NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); #else /* VECT_TAB_FLASH */ /* Set the Vector Table base location at 0x08000000 */ NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0); #endif NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1); //PVD NVIC_InitStructure.NVIC_IRQChannel = PVD_IRQChannel; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); }
EXTI配置:
void ExterLineInterrupt(void) { EXTI_InitTypeDef EXTI_InitStructure; EXTI_DeInit(); EXTI_StructInit(&EXTI_InitStructure); EXTI_InitStructure.EXTI_Line = EXTI_Line16; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); }
进中断程序:
void PVD_IRQHandler(void) { if (PWR_GetFlagStatus(PWR_FLAG_PVDO)) { PWR_ClearFlag(PWR_FLAG_PVDO); ````` ``` ``` } }
请问我哪有错误,谢谢
|
|