当前位置:网站首页>Application of external interrupts
Application of external interrupts
2022-07-03 09:56:00 【Yiao】
One . External interrupt 0 application
1·k3 control LED flashing
#include"reg51.h"
typedef unsigned char u8;
typedef unsigned int u16;
sbit led1=P2^0;
sbit led2=P2^1;
sbit led3=P2^2;
sbit led4=P2^3;
sbit led5=P2^4;
sbit led6=P2^5;
sbit k3=P3^2;
void delay(u16 i)
{
while(i--);
}
void zhongduan()
{
EA=1;
IT0=1;
EX0=1;
}
void main()
{
zhongduan();
}
void Int0() interrupt 0
{
delay(1000);
if(k3==0)
{
led1=~led1;
led2=~led2;
led3=~led3;
led4=~led4;
led5=~led5;
led6=~led6;
}
}
effect
Mistakes :
void main()
{
void zhongduan();
}
2· Control the buzzer
#include"reg51.h"
typedef unsigned char u8;
typedef unsigned int u16;
sbit beep=P1^5;
sbit k3=P3^2;
void delay(u16 i)
{
while(i--);
}
void zhongduan()
{
EA=1;
IT0=0;
EX0=1;
}
void main()
{
zhongduan();
}
void Int0() interrupt 0
{
if(k3==0)
{
beep=~beep;
delay(10);
}
}
边栏推荐
- Error output redirection
- 01仿B站项目业务架构
- There is no specific definition of embedded system
- 2020-08-23
- JS foundation - prototype prototype chain and macro task / micro task / event mechanism
- Project cost management__ Topic of comprehensive calculation
- [CSDN]C1训练题解析_第二部分_Web基础
- Project cost management__ Plan value_ Earned value_ Relationship among actual cost and Countermeasures
- Hal library sets STM32 clock
- 01仿B站项目业务架构
猜你喜欢
uniapp 实现微信小程序全局分享及自定义分享按钮样式
要选择那种语言为单片机编写程序呢
UCI and data multiplexing are transmitted on Pusch (Part V) -- polar coding
Mysql database underlying foundation column
UCI and data multiplexing are transmitted on Pusch - Part I
[combinatorics] Introduction to Combinatorics (combinatorial thought 2: mathematical induction | mathematical induction promotion | multiple induction thought)
单片机学到什么程度能找到工作,这个标准不好量化
Convert IP address to int
开学实验里要用到mysql,忘记基本的select语句怎么玩啦?补救来啦~
You need to use MySQL in the opening experiment. How can you forget the basic select statement? Remedy is coming~
随机推荐
SCM career development: those who can continue to do it have become great people. If they can't endure it, they will resign or change their careers
An executable binary file contains more than machine instructions
QT qcombobox QSS style settings
NR technology -- MIMO
MySQL data manipulation language DML common commands
Fundamentals of Electronic Technology (III)_ Chapter 2 principle of amplification circuit__ Crystal triode and field effect triode
[CSDN]C1训练题解析_第二部分_Web基础
Raspberry pie installation SciPy
MYSQL数据库底层基础专栏
Vector processor 9_ Basic multilevel interconnection network
Process communication - semaphore
2.Elment Ui 日期选择器 格式化问题
All processes of top ten management in project management
C language enumeration type
MySQL 数据库基础知识(系统化一篇入门)
Mobile phones are a kind of MCU, but the hardware it uses is not 51 chip
How does the nr-prach receiver detect the relationship between prembleid and Ta
Project cost management__ Cost management technology__ Article 7 completion performance index (tcpi)
[successful graduation] [1] - visit [student management information system]
03 FastJson 解决循环引用