#include "reg52.h"
typedef unsigned char u8;
typedef unsigned int u16;
sbit led = P2^0;
sbit k3=P3^2;
void int0Init()
{
EA=1;
EX0=1;
IT0=1;
}
void delayus(u16 i)
{
while(i--);
}
void main()
{
int0Init();
while(1);
}
void int0() interrupt 0
{
delayus(1000);
if (k3 == 0) led = ~led;
}
版权声明:本文为CSDN博主「acktomas」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/acktomas/article/details/104178852
暂无评论