直接上51的源碼
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar sz[16] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
int count=0,ms=0,sw=0,ll=0;
void ys(uint i)
{
uint x,j;
for(j=0;j<i;j++)
for(x=0;x<=148;x++);
}
void cs()
{
TMOD = 0x01;
TH0 = 0x4c;
TL0 = 0xb0;
EA=0;
ET=0;
TR0 = 1;
}
void dsq() interrupt 1
{
TH0 = 0x4c;
TL0 = 0xb0;
count++;
if(count >= 20)
{
count = 0;
ms++;
sw++;
}
}
void kkkk()
{
if(ms>9)
{ ms=0;
ll++;
}
if(ll>6)
ll=0;
if(sw>59)
sw=0;
}
void dis(void)
{
uint pp;
for(pp=0;pp<300;,pp++)
{
P0 = 0;
P2 = 1;
//// P0 = sz[ms];
// ys(3);
// if(sw>9)
// {
// P0 = 0;
// P2 = 6;
// P0 = sz[ll];
// ys(3);
// }
}
}
void main()
{
uchar j;
cs();
while(1)
{
// kkkk();
// dis();
P2 = 0;
P1 = 1;
}
}