完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
使用GPIOD的11管脚和12管脚用外部中断方式检查有无信号,下拉输入,上升沿触发,为什么给11管脚一个脉冲,两个中断都触发了呢,求高人帮忙 急!
void Exti_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; EXTI_InitTypeDef EXTI_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD|RCC_APB2Periph_GPIOC|RCC_APB2Periph_AFIO, ENABLE); //使能PD端口时钟 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; //下拉输入 //GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; //下拉输入 //GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOC, &GPIO_InitStructure); EXTI_InitStructure.EXTI_Line = EXTI_Line11|EXTI_Line12|EXTI_Line15|EXTI_Line6; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); /***指定中断源*****/ GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource11); GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource12); GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource15); GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, GPIO_PinSource6); NVIC_InitStructure.NVIC_IRQChannel=EXTI9_5_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=1 ;//抢占优先级0 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //子优先级1 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能 NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器 NVIC_InitStructure.NVIC_IRQChannel=EXTI15_10_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=1 ;//抢占优先级0 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; //子优先级1 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能 NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器 EXTI_ClearITPendingBit(EXTI_Line11); EXTI_ClearITPendingBit(EXTI_Line15); EXTI_ClearITPendingBit(EXTI_Line12); EXTI_ClearITPendingBit(EXTI_Line6); } void EXTI15_10_IRQHandler(void) {//delay_ms(10); if(EXTI_GetITStatus(EXTI_Line11)!=RESET) { TZHFLAG1=1; EXTI_ClearFlag(EXTI_Line11); EXTI_ClearITPendingBit(EXTI_Line11); } if(EXTI_GetITStatus(EXTI_Line15)!=RESET) { TZHFLAG2=1; EXTI_ClearFlag(EXTI_Line15); EXTI_ClearITPendingBit(EXTI_Line15); } if(EXTI_GetITStatus(EXTI_Line12)!=RESET) { HZHFLAG1=1; EXTI_ClearFlag(EXTI_Line12); EXTI_ClearITPendingBit(EXTI_Line12); } } 这是部分程序 |
|
相关推荐
2个回答
|
|
大侠们帮帮忙吧
|
|
|
|
得镨科技(上海)有限公司专注于烧录器研发,Dediprog 品牌,从手动到自动,从专用到通用,从工程到量产全系列产品,均自主研发,市场需求多。欢迎询问。
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
FacenetPytorch人脸识别方案--基于米尔全志T527开发板
1362 浏览 0 评论
飞凌嵌入式ElfBoard ELF 1板卡-CAN编程示例之开发板测试
1096 浏览 0 评论
该问题是用APP给芯海科技的CST92F25芯片发指令是出现的
4080 浏览 1 评论
887 浏览 0 评论
1750 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-2 03:07 , Processed in 0.782521 second(s), Total 80, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号