当前位置:网站首页>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();
}
}
边栏推荐
- Do you choose pandas or SQL for the top 1 of data analysis in your mind?
- 氫氧化鈉是什麼?
- Binary search (half search)
- Interpretation of the earliest sketches - image translation work sketchygan
- Delayqueue usage and scenarios of delay queue
- The SQL implementation has multiple records with the same ID, and the latest one is taken
- Netease to B, soft outside, hard in
- Hdu1231 maximum continuous subsequence (divide and conquer or dynamic gauge or double pointer)
- [vscode] prohibit the pylance plug-in from automatically adding import
- Matrix and TMB package version issues in R
猜你喜欢
Logical structure and physical structure
Jenkins reported an error. Illegal character: '\ufeff'. Class, interface or enum are required
Using GEE plug-in in QGIS
Pytorch has been installed in anaconda, and pycharm normally runs code, but vs code displays no module named 'torch‘
Target detection series - detailed explanation of the principle of fast r-cnn
U-boot initialization and workflow analysis
HDU1232 畅通工程(并查集)
Concurrent programming - how to interrupt / stop a running thread?
[untitled]
[idea] efficient plug-in save actions to improve your work efficiency
随机推荐
C#学习笔记
SOC_ SD_ DATA_ FSM
Application of MATLAB in Linear Algebra (4): similar matrix and quadratic form
Use of Pai platform
Raspberry pie 4B arm platform aarch64 PIP installation pytorch
(tool use) how to make the system automatically match and associate to database fields by importing MySQL from idea and writing SQL statements
Ros2 - ros2 vs. ros1 (II)
Matlab在线性代数中的应用(四):相似矩阵及二次型
What does soda ash do?
Using GEE plug-in in QGIS
Xiaomi written test real question 1
How can Oracle SQL statements modify fields that are not allowed to be null to allow nulls?
Unity ugui how to match and transform coordinates between different UI panels or uis
docker安装mysql并使用navicat连接
纯碱是做什么的?
And let's play dynamic proxy (extreme depth version)
SOC_ SD_ CMD_ FSM
数学分析_笔记_第8章:重积分
D2L installation
Ros2 - install ros2 (III)