当前位置:网站首页>STM32F4的外部中断
STM32F4的外部中断
2022-07-15 16:11:00 【一骜】
外部中断概述
stm32 有22个外部中断
EXTI线0~15:对应外部IO口的输入中断。
EXTI线16:连接到PVD输出。
EXTI线17:连接到RTC闹钟事件。
EXTI线18:连接到USB OTG FS唤醒事件。
EXTI线19:连接到以太网唤醒事件。
EXTI线20:连接到USB OTG HS(在FS中配置)唤醒事件。
EXTI线21:连接到RTC入侵和时间戳事件。
EXTI线22:连接到RTC唤醒事件。
stm32f4的每个IO口都可以作为外部中断的输入,中断线0到15可以作为IO口的中断输入,但是IO口有一百多个,那如何将IO口与中断一一对应起来呢?下图给出答案:
每一个中断线,对应相同IO口的序号。
外部中断的一般配置步骤
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA,EXTI_PinSource0);//PA0 连接到中断线0
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOE,EXTI_PinSource2);//PE2 连接到中断线2
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOE,EXTI_PinSource3);//PE3 连接到中断线3
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOE,EXTI_PinSource4);//PE4 连接到中断线4④初始化线上中断,设置触发条件等。EXTI_Init();
EXTI_InitTtt.EXTI_Line =(选择中断线)
EXTI_Line0/1/2/3/4/5...../22
EXTI_InitTtt.EXTI_LineCmd=(选择是否使能)
DISABLE/ENABLE
EXTI_InitTtt.EXTI_Mode=(选择中断模式)
EXTI_Mode_Interrupt/EXTI_Mode_Event
EXTI_InitTtt.EXTI_Trigger=(选择触发方式)
EXTI_Trigger_Rising
EXTI_Trigger_Falling
EXTI_Trigger_Rising_Falling//任意电平触发
EXTI_Init(&EXTI_InitTtt);⑤配置中断分组(NVIC),并使能中断。NVIC_Init();
⑥ 编写中断服务函数。EXTIx_IRQHandler();
⑦清除中断标志位EXTI_ClearITPendingBit();
边栏推荐
- bisect模块
- 理财平台选择哪个安全可靠
- 【2022微信小程序排雷】云开发和非云开发环境下如何正确获取openid?
- O & M - mélange de compétences
- [special topic of golang database 4] golang language operation PostgreSQL for addition, deletion, modification and query
- Go+mysql+redis+vue3 simple chat room, the fourth bullet: Gin's websocket communication and multi go task processing
- Beihang & Institute of Information Technology & meituan proposed lbdt, which is based on spatiotemporal interaction of language bridging to accurately segment directional video objects, with performan
- ECCV 2022 | 多域长尾分布学习,不平衡域泛化问题研究(开源)
- 双倍数据速率同步动态随机存储器(Double Data Rate Synchronous Dynamic Random Access Memory, DDR SDRAM)
- 【golang】基于go语言的堆结构模板
猜你喜欢
随机推荐
杰理之本无法搜索到蓝牙解决方法【篇】
运维-技能大杂烩
【系统设计】4S分析法
线性代数 笔记2
Using JMeter pressure test upload and download interface practice
Experience first! What kind of experience is it to write fluent in the browser?
Xiamarin integrates braze to realize messaging and end-to-end notification
讓企業數字化砸鍋和IT主管背鍋的軟件供應鏈安全風險指北
关于 c 打印异常的问题
杰理之用一拖二烧录器烧录注意【篇】
Notes on linear algebra 2
差距大?不同学历考生考研的要求和条件
Les risques pour la sécurité de la chaîne d'approvisionnement logicielle liés à la numérisation des entreprises et à la gestion des TI
運維-技能大雜燴
炒期货到哪里开户?如何开户更安全?
Is it safe for qiniu securities to open an account? Is it reliable?
Win11如何设置多任务窗口?Win11设置多任务窗口的方法
從數字化到智能運維:有哪些價值,又有哪些挑戰?
迪文串口屏教程(1)
40+倍提升,详解 JuiceFS 元数据备份恢复性能优化之路









