本文共 814 字,大约阅读时间需要 2 分钟。
【资源下载】下载地址如下1428:
unsigned int TimerCount,SystemSpeed,SystemSpeedIndex;unsigned int code SpeedCode[]={ 1, 2, 3, 5, 8, 10, 14, 17, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 160, 180, 200, 300, 400, 500, 600, 700, 800, 900,1000};//30void SetSpeed(unsigned char Speed){ SystemSpeed =SpeedCode[Speed];}void LEDShow(unsigned int LEDStatus){ P1 = ~(LEDStatus&0x00FF); P0 = ~((LEDStatus>>8)&0x00FF);}//Mode 0unsigned int LEDIndex = 0;bit LEDDirection = 1,LEDFlag = 1;void Mode_0(void){ LEDShow(0x0001<<LEDIndex); LEDIndex = (LEDIndex+1)%16;}//Mode 1void Mode_1(void){ LEDShow(0x8000>>LEDIndex); LEDIndex = (LEDIndex+1)%16;}//Mode 2void Mode_2(void){ if(LEDDirection) LEDShow(0x0001<<LEDIndex); else LEDShow(0x8000>>LEDIndex); if(LEDIndex==15) LEDDirection = !LEDDirection;
转载地址:http://jkiwz.baihongyu.com/