我不知道错在哪里了
#include<reg51.h>#define uchar unsigned char
uchar duanma [10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
uchar weima [10]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x10};
uchar nanbei[3]={40,35,4};
uchar dongxi [3]={35,4,40};
uchar dxdeng [3]={0x01,0x04,0x02};
uchar nbdeng [3]={0x80,0x40,0x20};
uchar jishu1, jishu2, dxjishu, nbjishu, dxmiao,nbmiao,shi, fen, miao, nlmiao;
uchar xianshi [10]={0,0,0,0,0,0,0,0,0,0};
sbit D1=P3^0;
bit naoling;
void yanshi10ms (void)
{
uchar i,j;
for(i=20;i>0;i--)
for(j=250;j>0;j--);
}
void chushihua (void) //初始化函数
{
TMOD=0X11;
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
TH1=(65536-1000)/256;
TL1=(65536-1000)%256;
EA=1; ET0=1; EX0=1; IT0=1; ;IT1=1; TR0=1;
}
void anjian(void) interrupt 0 // 外部中断
{
yanshi10ms();
if(INT0==0);
{
if((dxmiao<=50) && (nbmiao<=50));
{
dxmiao+=10;
nbmiao+=10;
}
}
}
void main (void) // 主函数
{
shi=21; fen=58; miao=0;
dxmiao=dongxi[0];
nbmiao=nanbei[0];
chushihua ();
while (1)
{
if((shi=22)&&(fen==00)&&(miao=00))
{
TR1=1;
naoling=1;
}
if(nlmiao==5);
{
nlmiao=0;
TR1=0;
naoling=0;
yanshi10ms();
}
}
}
void daojishi (void) interrupt 1 //定时器T0中服务函数
{
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
xianshi[0]=duanma[shi/10];
xianshi[1]=duanma[shi%10];
xianshi[2]=duanma[fen/10];
xianshi[3]=duanma[fen%10];
xianshi[4]=duanma[miao/10];
xianshi[5]=duanma[miao%10];
xianshi[6]=duanma[nbmiao/10];
xianshi[7]=duanma[nbmiao%10];
xianshi[8]=duanma[dxmiao/10];
xianshi[9]=duanma[dxmiao%10];
jishu1++;
if(jishu1==10) jishu1=0;
P0=weima [jishu1];
P1=xianshi [jishu1];
P2=dxdeng [dxjishu] | nbdeng [nbjishu];
jishu2++;
if(jishu2==100)
{
if(naoling)
nlmiao++;
jishu2=0;
{
yanshi10ms();
miao++;
{
if(miao==60)
{
miao=0;
fen++;
{
if(fen==60)
fen=0;
shi++;
if(shi==24)
shi=0;
}
}
}
dxmiao--; nbmiao--;
if(dxmiao==0xff)
{
dxjishu++;
if(dxjishu==3) dxjishu=0;
dxmiao=dongxi[dxjishu];
}
if(nbmiao==0xff)
{
nbjishu++;
if(nbjishu==3) nbjishu=0;
nbmiao=nanbei[nbjishu];
}
}
}
}
//定时器T1控制蜂鸣器器输出
void naol (void) interrupt 3
{
TH1=(65536-1000)/256;
D1=~D1;
TL1=(65536-1000)%256;
}
手高的谁知道错在哪里 了呀!帮帮我,谢谢了。我想了一个月了没有想通