跑马灯因为Delay1000ms()太久了,应改为延时2ms左右
void ADC_Process()//显示处理
{
ADDR2 = 0; ADDR1 = 1; ADDR0 = 1;HC595SendData(LedBuff[0]);Delay2ms();HC595SendData(0);
ADDR2 = 1; ADDR1 = 0; ADDR0 = 1;HC595SendData(LedBuff[1]);Delay2ms();HC595SendData(0);
ADDR2 = 1; ADDR1 = 1; ADDR0 = 0;HC595SendData(LedBuff[2]);Delay2ms();HC595SendData(0);
}
void main()
{
while(1)
{
LedBuff[0] = LedChar[16]; //显示U
LedBuff[1] = LedChar[1]|0x80; //显示1.
LedBuff[2] = LedChar[0]; //显示0
for(i=0;i<167;i++)ADC_Process();
LedBuff[0] = LedChar[13]; //显示d
LedBuff[1] = LedChar[0]; //显示0
LedBuff[2] = LedChar[1]; //显示1
for(i=0;i<167;i++)ADC_Process();
LedBuff[0] = LedChar[10]; //显示A
LedBuff[1] = LedChar[0]; //显示0
LedBuff[2] = LedChar[2]; //显示2
for(i=0;i<167;i++)ADC_Process();
}
}转载
|