# include<REG51.H>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
uchar i;
//= = = = = = = = = = = =
void DelayMS(uint x) //延时
{
uchar i;
while(x--) for(i=0;i<120;i++);
}
//= = = = = = = = = = = =
int1() interrupt 2 //K1中断程序
{char k;
for(k=0;k<=2;k++)
{P0=0x00; //发光二极管全亮
DelayMS(150);
P0=0xFF; //发光二极管全灭
DelayMS(150);
}
}
//= = = = = = = = = = = = = =
void main()
{
IT1=0;
EX1=1;
EA=1;
P0=0xfe;
while(1)
{DelayMS(150);
P0=_crol_(P0,1); //P0 的值向左循环移动
DelayMS(150);
} }
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
外中断的标志位可以由硬件清除,一般不需要人为干预
一周热门 更多>