#include
#include
#define LED P0
sbit K=P1^0;
unsigned char KEY=0;
void Delay(unsigned int n)
{
unsigned char a,b;
for(;n>0;n--)
{
for(b=1;b>0;b--)
for(a=22;a>0;a--);
}
}
void Intconfiguration(void)
{
IT0=1;
EX0=1;
EA=1;
}
void Int() interrupt 0
{
Delay(1);
if(K==0)
{
KEY=1;
}
}
void main()
{
LED=0xfe;
Intconfiguration();
while(1) {
if(KEY==1)
{
LED=_cror_(LED,1);
}
if(KEY==0)
{
LED=_crol_(LED,1);
}
Delay(2000);
}
}