当前位置:网站首页>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);
}
}
边栏推荐
- Getting started with JMX, MBean, mxbean, mbeanserver
- STM32 interrupt priority management
- Fundamentals of Electronic Technology (III)__ Chapter 1 resistance of parallel circuit
- Nr-prach: access scenario and access process
- el-table X轴方向(横向)滚动条默认滑到右边
- 【男保姆式】教你打开第一个微信小程序
- C language enumeration type
- UCI and data multiplexing are transmitted on Pusch (Part VI) -- LDPC coding
- Simple use of MySQL (addition, deletion, modification and query)
- 03 FastJson 解决循环引用
猜你喜欢

单片机职业发展:能做下去的都成牛人了,熬不动就辞职或者改行了

You need to use MySQL in the opening experiment. How can you forget the basic select statement? Remedy is coming~

el-table X轴方向(横向)滚动条默认滑到右边

Quelle langue choisir pour programmer un micro - ordinateur à puce unique

In third tier cities and counties, it is difficult to get 10K after graduation
![【顺利毕业】[1]-游览 [学生管理信息系统]](/img/91/72cdea3eb3f61315595330d2c9016d.png)
【顺利毕业】[1]-游览 [学生管理信息系统]

03 FastJson 解决循环引用
![[CSDN]C1训练题解析_第二部分_Web基础](/img/91/72cdea3eb3f61315595330d2c9016d.png)
[CSDN]C1训练题解析_第二部分_Web基础

Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()

There is no specific definition of embedded system
随机推荐
端午节快乐!—— canvas写的粽子~~~~~
Not many people can finally bring their interests to college graduation
自動裝箱與拆箱了解嗎?原理是什麼?
GPIO port details, Hal library operation keys
MySQL 数据库基础知识(系统化一篇入门)
Do you understand automatic packing and unpacking? What is the principle?
一个可执行的二进制文件包含的不仅仅是机器指令
MySQL data manipulation language DML common commands
[csdn] C1 analyse des questions de formation Partie III Bar _ JS Foundation
【顺利毕业】[1]-游览 [学生管理信息系统]
How does the memory database give full play to the advantages of memory?
01仿B站项目业务架构
Gpiof6, 7, 8 configuration
UCI and data multiplexing are transmitted on Pusch - placement of data and UCI positions (Part III)
JMX、MBean、MXBean、MBeanServer 入门
Mysql database underlying foundation column
Project cost management__ Cost management technology__ Article 7 completion performance index (tcpi)
[22 graduation season] I'm a graduate yo~
我想各位朋友都应该知道学习的基本规律就是:从易到难
要选择那种语言为单片机编写程序呢