当前位置:网站首页>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);
}
}
边栏推荐
- When you need to use some functions of STM32, but 51 can't realize them, 32 naturally doesn't need to learn
- UCI and data multiplexing are transmitted on Pusch - Part I
- How does the nr-prach receiver detect the relationship between prembleid and Ta
- 学习开发没有捷径,也几乎不存在带路会学的快一些的情况
- JS foundation - prototype prototype chain and macro task / micro task / event mechanism
- Successful graduation [3]- blog system update...
- Epollet lessons
- Project scope management__ Scope management plan and scope specification
- 单片机职业发展:能做下去的都成牛人了,熬不动就辞职或者改行了
- Gpiof6, 7, 8 configuration
猜你喜欢
![[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer](/img/90/4de927e797ec9c2bb70e507392bed0.jpg)
[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer

There is no specific definition of embedded system

JS foundation - prototype prototype chain and macro task / micro task / event mechanism

Mysql database underlying foundation column

Eight working modes of stm32gpio and chip naming rules

SSB Introduction (PbCH and DMRs need to be supplemented)

STM32 external interrupt experiment

GPIO port details, Hal library operation keys

对于新入行的同学,如果你完全没有接触单片机,建议51单片机入门

Oracle数据库 SQL语句执行计划、语句跟踪与优化实例
随机推荐
Getting started with shell programming
01仿B站项目业务架构
Mysql database underlying foundation column
STM32 external interrupt experiment
嵌入式本来就很坑,相对于互联网来说那个坑多得简直是难走
Oracle数据库 SQL语句执行计划、语句跟踪与优化实例
Epoll read / write mode in LT and et modes
Project cost management__ Cost management technology__ Article 7 completion performance index (tcpi)
byte alignment
Assignment to '*' form incompatible pointer type 'linkstack' {aka '*'} problem solving
要選擇那種語言為單片機編寫程序呢
内存数据库究竟是如何发挥内存优势的?
2.Elment Ui 日期选择器 格式化问题
The third paper of information system project manager in soft examination
对于新入行的同学,如果你完全没有接触单片机,建议51单片机入门
干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
STM32 serial communication principle
Education is a pass and ticket. With it, you can step into a higher-level environment
Stm32-hal library learning, using cubemx to generate program framework
[csdn] C1 analyse des questions de formation Partie III Bar _ JS Foundation