流水灯左移右移闪烁

#include
void Delay(int t)
{
	while(t--);
}
void main()
{
	unsigned char i,temp;
	while(1)
	{
		P1=0xfc;	
		for(i=0;i<7;i++)
		{	
			Delay(50000);
			temp=P1<<1;
			temp=temp|0x01;
			P1=temp;
		}	
		P1=0x3f;
		for(i=0;i<7;i++)
		{		
			Delay(50000);
			temp=P1>>1;
			temp=temp|0x80;
			P1=temp;
		}
		for(i=0;i<3;i++)
		{
			P1=0xff;
			Delay(50000);
			P1=0x00;
			Delay(50000);
		}
	}
}

  

转载于:https://www.cnblogs.com/fengyepiaolei/archive/2011/11/18/2254539.html

你可能感兴趣的:(流水灯左移右移闪烁)