这个程序有什么问题,是52单片机,在开发板上只是显示两个数码管一直是零,亲各位前辈指点。
#include<reg52.h>
#define uchar unsigned char
sbit dual=P2^6;
sbit weal=P2^7;
sbit led=P1^0;
uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,
0x6d,0x7d,0x07,0x7f,0x6f};
uchar num1,num2,num,shi,ge;
void delay(uchar mxs)
{
int i,j;
for(i=mxs;i>0;i--)
for(j=110;j>0;j--);
}
void xing()
{
dual=1;
P0=table[ge];
dual=0;
P0=0xff;
weal=1;
P0=0xfd;
weal=0;
delay(5);
dual=1;
P0=table[shi];
dual=0;
P0=0xff;
weal=1;
P0=0xfe;
weal=0;
delay(5);
}
void main()
{
TMOD=0x11;
TH0=(65536-45872)/265;
TL0=(65536-45872)%256;
TH1=(65536-45872)/256;
TL1=(65536-45872)%256;
EA=1;
ET0=1;
ET1=1;
TR0=1;
TR1=0;
while(1)
{
xing();
}
}
void T0_time()interrupt 1
{
TH0=(65536-45872)/256;
TL0=(65536-45872)%256;
num1++;
if(num1==4)
{
num1=0;
led=~led;
}
}
void T1_time() interrupt 3
{
TH1=(65536-45872)/256;
TL1=(65536-45872)%256;
num2++;
if(num2==20)
{
num2=0;
num++;
if(num==60)
{
num=0;
}
ge=num%10;
shi=num/10;
}
}
|