当前位置:网站首页>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);
}
}
边栏推荐
- Stm32f04 clock configuration
- Matlab reads hexadecimal numbers and converts them into signed short
- (1) 什么是Lambda表达式
- C language enumeration type
- 应用最广泛的8位单片机当然也是初学者们最容易上手学习的单片机
- Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
- Project cost management__ Cost management technology__ Article 8 performance review
- JMX、MBean、MXBean、MBeanServer 入门
- [combinatorics] Introduction to Combinatorics (combinatorial thought 2: mathematical induction | mathematical induction promotion | multiple induction thought)
- Uniapp realizes global sharing of wechat applet and custom sharing button style
猜你喜欢

An executable binary file contains more than machine instructions

Definition and use of enum in C language

Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit

单片机现在可谓是铺天盖地,种类繁多,让开发者们应接不暇

JMX、MBean、MXBean、MBeanServer 入门

How does the nr-prach receiver detect the relationship between prembleid and Ta

STM32 interrupt switch

Not many people can finally bring their interests to college graduation

Mysql database underlying foundation column

STM32 external interrupt experiment
随机推荐
UCI and data multiplexing are transmitted on Pusch (Part 4) --small block lengths
Fundamentals of Electronic Technology (III)__ Fundamentals of circuit analysis__ Basic amplifier operating principle
编程思想比任何都重要,不是比谁多会用几个函数而是比程序的理解
There is no specific definition of embedded system
MYSQL数据库底层基础专栏
Successful graduation [2] - student health management system function development...
Emballage automatique et déballage compris? Quel est le principe?
[combinatorics] Introduction to Combinatorics (combinatorial thought 2: mathematical induction | mathematical induction promotion | multiple induction thought)
【順利畢業】[1]-遊覽 [學生管理信息系統]
numpy. Reshape() and resize() functions
Matlab reads hexadecimal numbers and converts them into signed short
Getting started with shell programming
[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer
Mysql database underlying foundation column
You need to use MySQL in the opening experiment. How can you forget the basic select statement? Remedy is coming~
端午节快乐!—— canvas写的粽子~~~~~
Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit
Characteristics of PUCCH formats
STM32 interrupt switch
学历是一张通行证,门票,你有了它,可以踏入更高层次的环境里