用数码管显示两位数,个位数显示不出来,能帮我看看错在哪里了
程序如下
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar temp,shi,ge;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71
};
sbit dula=P2^0;
sbit wela=P2^1;
void delay (uint z);
void main()
{
temp=25;
while(1)
{
shi=temp/10;
ge=temp%10;
dula=1;
P0=table[shi];
dula=0;
wela=1;
P0=0xfe;
wela=0;
delay(5);
dula=1;
P0=table[ge];
dula=0;
wela=1;
P0=0xfd;
wela=0;
delay(5);
}
}
void delay(uint z)
{
uint i,j;
for(i=z;i>0;i++)
for(j=110;j>0;j++);
}
|