当前位置:网站首页>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();
}
}
边栏推荐
- [software testing] 06 -- basic process of software testing
- 小米笔试真题一
- Xiaomi written test real question 1
- SOC_SD_CMD_FSM
- Mid 2022 documentary -- the experience of an ordinary person
- 【Node】nvm 版本管理工具
- [software testing] 03 -- overview of software testing
- Typescript get timestamp
- Logical structure and physical structure
- 逻辑结构与物理结构
猜你喜欢
[software testing] 04 -- software testing and software development
Ros2 - node (VII)
Target detection series - detailed explanation of the principle of fast r-cnn
U-boot initialization and workflow analysis
(tool use) how to make the system automatically match and associate to database fields by importing MySQL from idea and writing SQL statements
DelayQueue延迟队列的使用和场景
1290_ Implementation analysis of prvtaskistasksuspended() interface in FreeRTOS
Three body goal management notes
611. 有效三角形的个数
一文揭开,测试外包公司的真实情况
随机推荐
【软件测试】05 -- 软件测试的原则
1290_FreeRTOS中prvTaskIsTaskSuspended()接口实现分析
能量守恒和打造能量缺口
arcgis_ spatialjoin
What is sodium hydroxide?
Netease to B, soft outside, hard in
DataGrid offline installation of database driver
What is soda?
[node] NVM version management tool
NPM and package common commands
611. 有效三角形的个数
程序中的负数存储及类型转换
[software testing] 03 -- overview of software testing
Ros2 - configuration development environment (V)
Lexin interview process
【软件测试】04 -- 软件测试与软件开发
What does soda ash do?
SOC_ SD_ CMD_ FSM
2022年PMP项目管理考试敏捷知识点(7)
SOC_SD_DATA_FSM