当前位置:网站首页>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();
}
}
边栏推荐
- 【软件测试】05 -- 软件测试的原则
- 氫氧化鈉是什麼?
- Docker installs MySQL and uses Navicat to connect
- 睿智的目标检测59——Pytorch Focal loss详解与在YoloV4当中的实现
- R language learning notes 1
- Hdu1232 unimpeded project (and collection)
- Database SQL practice 4. Find the last of employees in all assigned departments_ Name and first_ name
- Using GEE plug-in in QGIS
- DataGrid offline installation of database driver
- Oracle code use
猜你喜欢
随机推荐
【软件测试】03 -- 软件测试概述
Chapter 2: try to implement a simple bean container
Brief description of inux camera (Mipi interface)
Lexin interview process
基于FPGA的一维卷积神经网络CNN的实现(八)激活层实现
Steps and FAQs of connecting windows Navicat to Alibaba cloud server MySQL
Do you choose pandas or SQL for the top 1 of data analysis in your mind?
NPM and package common commands
Import CV2 prompt importerror: libgl so. 1: Cannot open shared object file: no such file or directory
SOC_SD_DATA_FSM
2022 PMP project management examination agile knowledge points (7)
【软件测试】02 -- 软件缺陷管理
剑指 Offer 56 数组中数字出现的次数(异或)
Using GEE plug-in in QGIS
Oracle code use
能量守恒和打造能量缺口
【obs】x264编码:“buffer_size“
Matlab在线性代数中的应用(四):相似矩阵及二次型
Ros2 - Service Service (IX)
SOC_ SD_ CMD_ FSM