DIY编程器网

标题: 流水灯电路(含源程序代码) [打印本页]

作者: liyf    时间: 2011-6-5 06:32
标题: 流水灯电路(含源程序代码)
流水灯电路(含源程序代码)



其实现程序:
#i nclude
unsigned char RunMode;
//**********************************System Fuction*************************************************
void Delay1ms(unsigned int count)
{
unsigned int i,j;
for(i=0;ifor(j=0;j>8)&0x00FF);
}
void InitialCPU(void)
{
RunMode = 0x00;
TimerCount = 0;
SystemSpeedIndex = 10;
P1 = 0x00;
P0 = 0x00;
P2 = 0xFF;
P3 = 0x00;
Delay1ms(500);
P1 = 0xFF;
P0 = 0xFF;
P2 = 0xFF;
P3 = 0xFF;
SetSpeed(SystemSpeedIndex);
Display(RunMode);
}
//Mode 0
unsigned int LEDIndex = 0;
bit LEDDirection = 1,LEDFlag = 1;
void Mode_0(void)
{
LEDShow(0x0001>LEDIndex);
LEDIndex = (LEDIndex+1)%16;
}
//Mode 2
void Mode_2(void)
{
if(LEDDirection)
LEDShow(0x0001>LEDIndex);
if(LEDIndex==15)
LEDDirection = !LEDDirection;




欢迎光临 DIY编程器网 (http://diybcq.com/) Powered by Discuz! X3.2