当前位置:网站首页>单片机外部中断触发方式:电平触发和边沿触发两者说明
单片机外部中断触发方式:电平触发和边沿触发两者说明
2022-07-20 15:34:00 【perseverance52】
单片机外部中断触发方式:电平触发和边沿触发两者说明
51单片机的外部中断有两种触发方式可选:电平触发和边沿触发。选择电平触发时,单片机在每个机器周期检查中断源口线,检测到低电平,即置位中断请求标志,向CPU请求中断。选择边沿触发方式时,单片机在上一个机器周期检测到中断源口线为高电平,下一个机器周期检测到低电平,即置位中断标志,请求中断。
电平触发方式(IT0=0,IT1=0
)
电平触发方式时,中断标志寄存器不锁存中断请求信号。也就是说,单片机把每个机器周期的S5P2采样到的外部中断源口线的电平逻辑直接赋值到中断标志寄存器。标志寄存器对于请求信号来说是透明的。这样当中断请求被阻塞而没有得到及时响应时,将被丢失。换句话说,要使电平触发的中断被CPU响应并执行,必须保证外部中断源口线的低电平维持到中断被执行为止。因此当CPU正在执行同级中断或更高级中断期间,产生的外部中断源(产生低电平)如果在该中断执行完毕之前撤销(变为高电平)了,那么将得不到响应,就如同没发生一样。同样,当CPU在执行不可被中断的指令(如RETI)时,产生的电平触发中断如果时间太短,也得不到执行。
边沿触发方式(IT0=1,IT1=1
)
边沿触发方式时,中断标志寄存器锁存了中断请求。中断口线上一个从高到低的跳变将记录在标志寄存器中,直到CPU响应并转向该中断服务程序时,由硬件自动清除。因此当CPU正在执行同级中断(甚至是外部中断本身)或高级中断时,产生的外部中断(负跳变)同样将被记录在中断标志寄存器中。在该中断退出后,将被响应执行。如果你不希望这样,必须在中断退出之前,手工清除外部中断标志。
中断标志可以手工清除。一个中断如果在没有得到响应之前就已经被手工清除,则该中断将被CPU忽略。就如同没有发生一样。选择电平触发还是边沿触发方式应从系统使用外部中断的目的上去考虑,
边栏推荐
- Bing 必应突然不能用了(2021 年 17 日最新情况),怎么办?问题已解决
- Hide & seek introduction -- end-to-end simulation and processing of radio observation data (I)
- [NeurIPS 2021] TokenLearner:自适应学习 token 个数和位置 - What Can 8 Learned Tokens Do for Images and Videos?
- 语义分割-Rethinking BiSeNet For Real-time Semantic Segmentation-1-Cityscapes数据集
- flv. JS' live broadcast optimization scheme of frame tracking, disconnection and reconnection and real-time update
- ON-LSTM介绍
- MySQL master-slave replication, read-write separation
- TCP three handshakes and four waves dialysis
- 直播预告 | 《开源安全治理模型和工具》线上研讨会
- Interpret the transfer() function in numpy in detail (with examples to help understand)
猜你喜欢
TCP three handshakes and four waves dialysis
The seemingly simple input box input is abnormally stuck. Remember a troubleshooting idea for daily performance problems
Generate arbitrary edge smooth shape (patch) artifact
Macro create inline function read / write CPU reg
@Function and principle of restcontrolleradvice
@ModelAttribute运用详解
HIDE & SEEK 介紹 -- 端到端的模擬和處理無線電觀測數據(二)
HIDE & SEEK 介绍 -- 端到端的模拟和处理无线电观测数据(一)
华为云:一切皆服务,共建全场景智慧金融
[论文速度] 同时解决成像时,曝光不足和曝光过度问题:Deep Reciprocating HDR Transformation
随机推荐
同花顺网上开户安全吗?十大证券公司有哪些?
UE5 官方案例LyraStarter 全特性详解 2.消息系统使用示例
文件映射(mmap)和sendfile和零copy之間的聯系和區別
[vs2019] printing Chinese characters in disorder
[paper speed] solve the problems of underexposure and overexposure during imaging at the same time: deep replicating HDR transformation
【Bug解决】VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
grafana - influxdb可视化 k6 输出
HIDE & SEEK 介绍 -- 端到端的模拟和处理无线电观测数据(二)
[NeurIPS 2021] TokenLearner:自适应学习 token 个数和位置 - What Can 8 Learned Tokens Do for Images and Videos?
LeetCode 1260.二维网格迁移:两种方法解决(k次模拟/一步到位)
李宏毅《机器学习》丨4. Deep Learning(深度学习)
记 - flink sql upset-kafka sink 数据乱序排查与解决思路【业务数据任意修改】
Huawei cloud: serve everything, build a whole scene of smart Finance
Machine learning by Li Hongyi 4 Deep learning
Review of research on multi task learning of intensive predictive tasks - optimization methods
机器学习—支持向量机理论详细推导(含例题讲解)(二)
@Function and principle of restcontrolleradvice
一套.Net Core学校管理系统源码
Interpret the transfer() function in numpy in detail (with examples to help understand)
redis 内存分析工具 RMA 使用