这是数码管显示界面,数码管出现闪烁,总有一个比其他微微亮,求助求助
这是为什么呢,问题在哪里?
void Delay600us(void) //@12.000MHz
{
unsigned char data i, j;
i = 7;
j = 254;
do
{
while (--j);
} while (--i);
}
void single_SMG(unsigned char pos,unsigned char dat)
{
select_channel(6);
P0=0x01<<pos;
select_channel(7);
P0=dat;
Delay600us(); //找到最合适的参数 两个都是1ms
select_channel(6);
P0=0xff;
select_channel(7);
P0=0xff;
Delay600us();
}
//***************************************************
//**************************************************8
void SMG_display()
{
switch(stat)
{
case 1: //时间界面
single_SMG(7,SMG_nodot[time[0]%16]);
single_SMG(6,SMG_nodot[time[0]/16]);
single_SMG(5,0xbf);
single_SMG(4,SMG_nodot[time[1]%16]);
single_SMG(3,SMG_nodot[time[1]/16]);
single_SMG(2,0xbf);
single_SMG(1,SMG_nodot[time[2]%16]);
single_SMG(0,SMG_nodot[time[2]/16]);
select_channel(6);
P0=0xff;
select_channel(7);
P0=0xff;
break;
case 2: //回显温度界面
if(action_n==0)
{
single_SMG(7,0xff);
single_SMG(6,0xff);
single_SMG(5,0xff);
single_SMG(4,0xff);
single_SMG(3,0xff);
single_SMG(2,0xff);
single_SMG(1,0xff);
single_SMG(0,SMG_nodot[12]); //C
}
else
{
single_SMG(7,SMG_nodot[temper_aver%10]);
single_SMG(6,SMG_dot[(temper_aver%100)/10]);
single_SMG(5,SMG_nodot[(temper_aver/100)]);
single_SMG(4,0xbf);
single_SMG(3,SMG_nodot[temper_max%10]);
single_SMG(2,SMG_nodot[temper_max%100/10]);
single_SMG(1,0xff);
single_SMG(0,SMG_nodot[12]);
}
break;
|