OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 6708|回复: 1

STM32F407低电压检测问题

[复制链接]

190

主题

401

帖子

0

精华

金牌会员

Rank: 6Rank: 6

积分
1291
金钱
1291
注册时间
2014-6-15
在线时间
144 小时
发表于 2014-8-12 13:24:53 | 显示全部楼层 |阅读模式
5金钱

STM32F407里当使能低电压检测的时候
如果电压低于阈值将触发相应的中断,
但是我测试发现进步了中断啊

咋回事

配置函数
 void PVD_Config(void)
 {
   NVIC_InitTypeDef NVIC_InitStructure;
   EXTI_InitTypeDef EXTI_InitStructure;
 
   /* Enable PWR clock */
   RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
 
                                                               
   /* Enable the PVD Interrupt */
   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);
       
   /* Configure EXTI Line16(PVD Output) to generate an interrupt on rising and
      falling edges */
   EXTI_ClearITPendingBit(EXTI_Line16);
   EXTI_InitStructure.EXTI_Line = EXTI_Line16;
   EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
   EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
   EXTI_InitStructure.EXTI_LineCmd = ENABLE;
   EXTI_Init(&EXTI_InitStructure);
 
   /* Configure the PVD Level to 3 (PVD detection level set to 2.5V, refer to the
       electrical characteristics of you device datasheet for more details) */
   WR_PVDLevelConfig(PWR_PVDLevel_3);
 
   /* Enable the PVD Output */
   WR_PVDCmd(ENABLE);
 }


中断函数




/*******************************************************************************
* Function Name : PVD_IRQHandler
* Description   : This function handles PVD interrupt request.
* Input         : None
* Output         : None
* Return         : None
*******************************************************************************/
void PVD_IRQHandler(void)
{
u8 tmp;

if(EXTI_GetITStatus(EXTI_Line16) != RESET)    {
GPIO_SetBits(GPIOE,GPIO_Pin_6); // 点亮LED
/* Method[0]=g_hAssemblyTestVar[0].uTestResault;

Method[1]=g_hAssemblyTestVar[0].u32_OpenCnt>>24;
Method[2]=g_hAssemblyTestVar[0].u32_OpenCnt>>16;
Method[3]=g_hAssemblyTestVar[0].u32_OpenCnt>>8;
Method[4]=g_hAssemblyTestVar[0].u32_OpenCnt&0XFF;

Method[5]=g_hAssemblyTestVar[0].u32_OpenFullCnt>>24;
Method[6]=g_hAssemblyTestVar[0].u32_OpenFullCnt>>16;
Method[7]=g_hAssemblyTestVar[0].u32_OpenFullCnt>>8;
Method[8]=g_hAssemblyTestVar[0].u32_OpenFullCnt&0XFF;


Method[9]=g_hAssemblyTestVar[0].u32_CloseCnt>>24;
Method[10]=g_hAssemblyTestVar[0].u32_CloseCnt>>16;
Method[11]=g_hAssemblyTestVar[0].u32_CloseCnt>>8;
Method[12]=g_hAssemblyTestVar[0].u32_CloseCnt&0XFF;

Method[13]=g_hAssemblyTestVar[0].u32_CloseFullCnt>>24;
Method[14]=g_hAssemblyTestVar[0].u32_CloseFullCnt>>16;
Method[15]=g_hAssemblyTestVar[0].u32_CloseFullCnt>>8;
Method[16]=g_hAssemblyTestVar[0].u32_CloseFullCnt&0XFF;

Method[17]=g_hAssemblyTestVar[0].u32_Close23cnt>>24;
Method[18]=g_hAssemblyTestVar[0].u32_Close23cnt>>16;
Method[19]=g_hAssemblyTestVar[0].u32_Close23cnt>>8;
Method[20]=g_hAssemblyTestVar[0].u32_Close23cnt&0XFF;

Method[21]=g_hAssemblyTestVar[0].u16_uStallCnt>>8;
Method[22]=g_hAssemblyTestVar[0].u16_uStallCnt&0XFF;
Method[23]=g_hAssemblyTestVar[0].StartTest;

sEE_WriteBuffer(Method, TESTCNTADDR,24);
tmp=0XAA;
sEE_WriteBuffer(&tmp, TESTCNTFLGADDR, 1);
  EXTI_ClearITPendingBit(EXTI_Line16);         

*/

 
}

}

我在中断里点灯,正常的话断电之后应该会闪亮一下的,
但是灯一直是灭的,
为啥呢

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2014-8-12 23:28:26 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-7-4 00:03

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表