#include<reg52.h>
typedef unsigned char uchar;
typedef
unsigned int uint;
void delay(uint t)
{while(--t);
}
void cycle(uchar s);
void main(void)
{
EA = 1;
EX0 = 1;
IT0 = 1;
P1= 0x00;
cycle(0);
while(1);
}
void cycle(uchar s)
{
while(1)
{
//P1=~(1<<s++);
P0=~(1<<s++); // P0 是流水灯
delay(15000);
if(s==8)
s=0;
delay(15000);
}
}
void int0() interrupt 0
{
P1++; // P1 是计数
}