#include<reg51.h>
#include<intrins.h>
#define led P2
typedef unsigned char u8;
typedef unsigned int u16;
void delay(u16 a)
{
while(a--);
}
void main()
{
u8 i=0;
led=0x00;
delay(50000);
led=0xfe;
for(i=0;i<8;i++)
{
led=~(led>>1);
delay(50000);
}
led=0xff;
delay(50000);
for(i=0;i<8;i++)
{
led=led>>1;
delay(50000);
}
led=0x7f;
delay(50000);
for(i=0;i<7;i++)
{
led=_cror_(led,1);
delay(5000);
}
led=0xff;
delay(50000);
led=0xaa;
delay(50000);
for(i=0;i<4;i++)
{
led=_crol_(led,1);
delay(50000);
}
led=0xcc;
delay(50000);
for(i=0;i<4;i++)
{
led=_crol_(led,2);
delay(50000);
}
led=0xf0;
delay(50000);
for(i=0;i<4;i++)
{
led=_crol_(led,4);
delay(50000);
}
led=0x00;
delay(50000);
}
|