#include<reg51.h>
void delay(unsigned int i)
{
unsigned char j;
for( ;i>0;i--)
for(j=244;j>0;j--);
}
void main()
{
unsigned char x,n;
while(1){
x=0x01;
for(n=0;n<8;n++){
P1=~x;
delay(1000);
x=x<<1;
}
}
}