LED流水灯(可控延时)

21 阅读1分钟
#include <REGX52.H>
void Delay1ms(unsigned int xms)		//@11.0592MHz
{
	unsigned char i, j;
	while(xms--){
		i = 2;
		j = 199;
		do
		{
			while (--j);
		} while (--i);
	}
}


void main(){
	while(1){
		P2 = 0xFE;
		Delay1ms(1000);
		P2 = 0xFF;
		Delay1ms(1000);
	}
	
}