Issues such as the topic, there may be a little long messy code, trouble bosses to help have a look at the problem in where, thanked!!
# include & lt; Reg52. H>
#include
# define uint unsigned int
# define uchar unsigned char
Sbit du=P2 ^ 6;
Sbit we=P2 ^ 7;
Sbit led=P1 ^ 0;
Uint shi_shi=0;
Uint shi=0;
Uint fen_shi=0;
Uint fen=0;
Uint miao_shi=0;
Uint miao=0;
Uchar num.
SFR AUXR=0 x8e;
Uchar duan []={x5b x3f 0, 0 x06, 0, 0 x4f, 0 x66, 0 x6d, 0 x7d, 0 x07, 0 x7f, 0 x6f};//section of the code
Uchar wei []={XFD 0 xfe, 0, 0 XFB, 0 xf7, 0 xef, 0 XDF, 0 XBF, 0 x7f};//a
Void InitTimer0 (void)
{
TMOD=0 x01;
TH0=0 x0ee;
TL0=0 x00;
EA=1;
ET0=1;
TR0=1;
}
Void Timer0Interrupt (void) interrupt 1
{
TH0=0 x0ee;
TL0=0 x00;
num++;
}
Void delay (uint k)//software delay
{
Uint I;
Uint j;
For (I=0; i For (j=0; J & lt; 114; j++);//raw data j & lt; 114
}
Void jisuan ()
{
If (miao==10)
{
Miao_shi + +;
Miao=0;
}
If (miao_shi==6)
{
Fen + +;
Miao_shi=0;
}
If (fen==10)
{
Fen_shi + +;
Fen=0;
}
If (fen_shi==6)
{
Shi++;
Fen_shi=0;
}
If (shi==10)
{
Shi_shi + +;
Shi=0;
}
If (shi_shi==2 & amp; Shi==4)
{
Shi=0;
Shi_shi=0;
}
}
Void main (void)
{
InitTimer0 ();
While (1)
{
If (num==200)
{
Num=0;
Led=~ led;
Miao++;
If (miao==10)
{
Miao_shi + +;
Miao=0;
}
If (miao_shi==6)
{
Fen + +;
Miao_shi=0;
}
If (fen==10)
{
Fen_shi + +;
Fen=0;
}
If (fen_shi==6)
{
Shi++;
Fen_shi=0;
}
If (shi==10)
{
Shi_shi + +;
Shi=0;
}
If (shi_shi==2 & amp; Shi==4)
{
Shi=0;
Shi_shi=0;
}
}
Du=1;
P0=duan (miao),
Du=0;
We=1;
P0=wei [7];
We=0;
Delay (1);
Du=1;
P0=duan [miao_shi];
Du=0;
We=1;
P0=wei [6].
We=0;
Delay (1);
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Du=1;
P0=0 x40;
Du=0;
We=1;
P0=wei [5];
We=0;
Delay (1);
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Du=1;
P0=duan (fen);
Du=0;
We=1;
P0=wei [4];
We=0;
Delay (1);
Du=1;
P0=duan [fen_shi];
Du=0;
We=1;
P0=wei [3].
We=0;
Delay (1);
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Du=1;
P0=0 x40;
Du=0;
We=1;
P0=wei [2];
We=0;
Delay (1);
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Du=1;
P0=duan (shi);
Du=0;
We=1;
P0=wei [1];
We=0;
Delay (1);
Du=1;
P0=duan [shi_shi];
Du=0;
We=1;
P0=wei [0];
We=0;
Delay (1);
}
}