void RCC_Conf(void)
{ ...
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
...
}
void NVIC_Conf(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
NVIC_InitStructure.NVIC_IRQChannel = PVD_IRQChannel;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = PVD_IRQ_PRI;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void EXTI_Conf(void)
{
EXTI_ClearITPendingBit(EXTI_Line16);
EXTI_InitStructure.EXTI_Line = EXTI_Line16;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;//EXTI_Trigger_Falling同样不响应
EXTI_Init(&EXTI_InitStructure);
}
int main()
{
RCC_Conf();
NVIC_Conf();
EXTI_Conf();
PWR_PVDLevelConfig(PWR_PVDLevel_2V9);
PWR_PVDCmd(ENABLE);
while(1);
}
void PVD_IRQHandler(void)
{
EXTI_ClearITPendingBit(EXTI_Line16);
if(PWR_GetFlagStatus(PWR_FLAG_PVDO))
{
此处向外部EEPROM写一个字;
试验过,在EXTI中断里这个字能写进去,放在这里就没写进去,说明这个中断根本没有响应。
//备注:这个中断的优先级最高(0,0)级的。
}
}
有谁知道这个悲剧是怎么造成的?
} |