本帖最后由 ningling_21 于 2014-5-20 10:53 编辑
while(1)
{
PORTC=adc_rst;
s_ms(3000);
run_cnt++;
if(run_cnt>30000)
{
run_cnt=0;
PORTG^=BIT(4);
}
switch(k)
{
case 0x80:
{
timp=0xc0;
}
break;
case 0x40:
{
timp=0xf9;
}
break;
case 0x20:
{
timp=0xa4;
}
break;
case 0x10:
{
timp=0xb0;
}
break;
case 0x08:
{
timp=0x99;
}
break;
case 0x04:
{
timp=0x92;
}
break;
case 0x02:
{
timp=0x82;
}
break;
case 0x01:
{
timp=0xf8;
}
break;
}
shift_out(k,timp); //595移位输出
k<<=1; //k =位选
if(k==0)
{
k=1;
}
}
} //ENDmain
只显示6个数字4,其它2位不显示
用MEGA128
用STC89C52驱动正常;
|