#include <INTRINS.H>
#include <REGX51.H>
unsigned char cnt=0;
unsigned char cnt1=1;
void Delay500ms() //@12.000MHz
{
unsigned char i, j, k;
i = 4;
j = 205;
k = 187;
do
{
do
{
while (--k);
} while (--j);
} while (--i);
}
void main()
{
P2=0x80;
while(1)
{
if(cnt<8)
{P0=~(0x01 << cnt);
Delay500ms();
cnt++;
}
else
{
P0=~(0x80 >> cnt1);
Delay500ms();
cnt1++;
if(P0=~(0x01))
{cnt=1;
}
}
}
}