摘要
外部中断在单片机应用系统中经常用于系统故障处理、采集数据的处理、人机交互的键盘输入以及通过按键唤醒单片机退出掉电工作模式等工作场景。STC15系列单片机外部中断0、外部中断1增加了上升沿或下降沿均可触发中断的新特性,这种新特性在使用时如果不加以注意可能会使中断服务程序重复执行两次,导致程序出错,尤其是在采集数据的处理、人机交互的键盘输入等应用场合埋下隐患。通过对使用STC15系列单片机的外部中断0、外部中断1的实例分析,给出解决方案。对使用STC15系列单片机进行系统设计,尤其是对原来使用STC89系列等通用51单片机的系统进行硬件升级后的软件移植具有重要指导意义和参考价值。
External interrupt is typically used in system fault processing,data acquisition,keyboard input and wake-up single-chip microcomputer to quit power-off mode.The external interrupt 0 and external interrupt 1 of STC15 series MCU add a new feature that the interrupt can be triggered by the rising edge or falling edge.If the user does not pay much attention to this feature,it may cause the interrupt service program to be executed twice,which will lead to a program error.This kind of new feature will have an underlying problem in the application of data acquisition processing,keyboard input of human-computer interaction and other applications.The examples of external interrupt 0 and external interrupt 1 of STC15 series MCU are discussed in this paper,the solutions are given.The study of this paper has important guiding significance and reference value for the system designed by STC15 series MCU,especially the software transplantation after a hardware upgrade of the original system used STC89 series and other general-purpose MCS 51 single-chip microcomputer.
作者
刘宝成
Liu Baocheng(College of Engineering,Inner Mongolia University for Nationalities,Tongliao 028043,China)
出处
《单片机与嵌入式系统应用》
2021年第2期39-43,共5页
Microcontrollers & Embedded Systems
基金
内蒙古自治区高等学校科学研究项目—无线电波充电技术的研究(NJZY17202)
内蒙古民族大学教育教学研究课题—实践教学的综合改革与实践的研究(YB2017008)。