当前位置:网站首页>Basic operation of external interrupt (keil5)
Basic operation of external interrupt (keil5)
2022-07-05 07:18:00 【After reading thousands of books, you can pick them up and put 】
I didn't press s5, Always execute the main program (L1 Keep flashing ), Press down s5, The main program is suspended , Execute the contents of the interrupt service function (L2 bright ,L2 After extinction ), Continue the main program just now (L1 Keep flashing ).
#include <STC15F2K60S2.H>
#include <intrins.h>
sbit L2=P0^1;
sbit L1=P0^0;
void initsystem()
{
P2=0xbf&(P2|0xe0);
P0=0x00;
P2=0x1f&(P2|0xe0);
P2=0x9f&(P2|0xe0);
P0=0xff;
P2=0x1f&(P2|0xe0);
}
void Delay500ms() //@11.0592MHz
{
unsigned char i, j, k;
_nop_();
_nop_();
i = 22;
j = 3;
k = 227;
do
{
do
{
while (--k);
} while (--j);
} while (--i);
}
void LED()
{
L1=0;
Delay500ms();
L1=1;
Delay500ms();
}
void Init_Timer()
{
IT0=1;
EX0=1;
EA=1;
}
void Iterrupt1() interrupt 0
{
L2=0;
Delay500ms();
Delay500ms();
Delay500ms();
Delay500ms();
L2=1;
}
void main()
{
Init_Timer();
initsystem();
P2=0x9f&(P2|0xe0);
while(1)
{
LED();
}
}
边栏推荐
- [vscode] prohibit the pylance plug-in from automatically adding import
- [node] NVM version management tool
- U-boot initialization and workflow analysis
- Raspberry pie 4B arm platform aarch64 PIP installation pytorch
- 能量守恒和打造能量缺口
- 【软件测试】05 -- 软件测试的原则
- Ros2 - function package (VI)
- C#学习笔记
- C语言数组专题训练
- [tf1] save and load parameters
猜你喜欢
SOC_ SD_ CMD_ FSM
【软件测试】02 -- 软件缺陷管理
网易To B,柔外刚中
Intelligent target detection 59 -- detailed explanation of pytoch focal loss and its implementation in yolov4
Ethtool principle introduction and troubleshooting ideas for network card packet loss (with ethtool source code download)
[software testing] 03 -- overview of software testing
U-boot initialization and workflow analysis
并发编程 — 死锁排查及处理
IPage can display data normally, but total is always equal to 0
PostMessage communication
随机推荐
Concurrent programming - how to interrupt / stop a running thread?
【idea】Could not autowire. No beans of xxx type found
2022 PMP project management examination agile knowledge points (7)
氫氧化鈉是什麼?
程序中的负数存储及类型转换
目标检测系列——Faster R-CNN原理详解
Solve tensorfow GPU modulenotfounderror: no module named 'tensorflow_ core. estimator‘
DelayQueue延迟队列的使用和场景
The difference between NPM install -g/-save/-save-dev
Negative number storage and type conversion in programs
PowerManagerService(一)— 初始化
What if the DataGrid cannot see the table after connecting to the database
Database SQL practice 3. Find the current salary details of the current leaders of each department and their corresponding department number Dept_ no
Machine learning Seaborn visualization
docker安装mysql并使用navicat连接
第 2 章:小试牛刀,实现一个简单的Bean容器
[vscode] search using regular expressions
剑指 Offer 56 数组中数字出现的次数(异或)
NPM and package common commands
Chapter 2: try to implement a simple bean container