用了N年的掉电数据源保存!
void PVD_NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure; //中断优先级配置
EXTI_InitTypeDef EXTI_InitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
NVIC_InitStructure.NVIC_IRQChannel = PVD_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
EXTI_StructInit(&EXTI_InitStructure);
EXTI_InitStructure.EXTI_Line = EXTI_Line16; //PVD连接到中断线16上
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; //使用中断模式
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; //电压低于阀值时产生中断
EXTI_InitStructure.EXTI_LineCmd = ENABLE; //使能中断线
EXTI_Init(&EXTI_InitStructure); //初始
PWR_PVDLevelConfig(PWR_PVDLevel_2V8);//设定监控阀值
PWR_PVDCmd(ENABLE);//使能PVD
}
/*-------------------------------------------------------------------------------
PVD中断
---------------------------------------------------------------------------------*/
void PVD_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line16) != RESET)
{
这里些:代码,需要保持的数据。。。
EXTI_ClearITPendingBit(EXTI_Line16);//清中断
}
} |