当前位置:网站首页>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();
}
}
边栏推荐
- SD_CMD_RECEIVE_SHIFT_REGISTER
- What is soda?
- 【软件测试】04 -- 软件测试与软件开发
- Import CV2, prompt importerror: libcblas so. 3: cannot open shared object file: No such file or directory
- [software testing] 02 -- software defect management
- 611. 有效三角形的个数
- docker安装mysql并使用navicat连接
- [untitled]
- Altimeter data knowledge point 2
- Course learning accumulation ppt
猜你喜欢

HDU1232 畅通工程(并查集)

U-Boot初始化及工作流程分析

Concurrent programming - how to interrupt / stop a running thread?

Target detection series - detailed explanation of the principle of fast r-cnn

Inftnews | drink tea and send virtual stocks? Analysis of Naixue's tea "coin issuance"

【无标题】

Logical structure and physical structure

Solve tensorfow GPU modulenotfounderror: no module named 'tensorflow_ core. estimator‘

Ros2 - node (VII)

Ros2 topic (VIII)
随机推荐
[framework] multi learner
SD_CMD_RECEIVE_SHIFT_REGISTER
剑指 Offer 56 数组中数字出现的次数(异或)
HDU1231 最大连续子序列(分治or动规or双指针)
Chapter 2: try to implement a simple bean container
[untitled]
现在有html文件,和用vs制作的mvc(连接了数据库),怎么两个相连?
M2dgr slam data set of multi-source and multi scene ground robot
arcgis_ spatialjoin
二分查找(折半查找)
DataGrid offline installation of database driver
Reading literature sorting 20220104
【obs】x264编码:“buffer_size“
Netease to B, soft outside, hard in
IPage能正常显示数据,但是total一直等于0
并发编程 — 如何中断/停止一个运行中的线程?
网易To B,柔外刚中
Batch convert txt to excel format
D2L installation
Database SQL practice 3. Find the current salary details of the current leaders of each department and their corresponding department number Dept_ no