在线时间0 小时
UID405683
ST金币0
蝴蝶豆0
注册时间2012-12-6
新手上路
- 最后登录
- 1970-1-1
|
a0a.1 0b0c
我是在定时器中断里通过串口发送数据,PVD中断设置的2.9V,掉电时在PVD中断里保存数据,然后上电时读取,可是偶尔会出现上电读取的数据是前一次保存的(也就是上一次的数据没有保存上),如果把定时器中断关了,串口发送在while里进行,保存读取都没有问题,请问这是怎么回事啊?定时器中断与PVD中断的优先级如下:
if(TIM == TIM1)
NVIC_InitStructure.NVIC_IRQChannel = TIM1_UP_IRQn;
else if(TIM == TIM2)
NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
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);
PVD中断如下:
void PVD_IRQHandler(void)
{
EXTI_ClearITPendingBit(EXTI_Line16);
if(PWR_GetFlagStatus(PWR_FLAG_PVDO))
{
EE_WriteVariable(0x5555, r);
EE_WriteVariable(0x6666, zero);
PWR_ClearFlag(PWR_FLAG_PVDO);
}
|
|