菜鸟求教!幼稚勿笑!
sbit duan=P2^0;
sbit wei=P2^1;
sbit key1=P3^5;
#define uchar unsigned char;
uchar code xtab[]={0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef};
uchar code distable[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
uchar a,b,c,d,e,i,j,k;
delay()
{
怎不不能发全?
#include<reg52.h>
sbit duan=P2^0;
sbit wei=P2^1;
sbit key1=P3^5;
#define uchar unsigned char;
uchar code xtab[]={0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef};
uchar code distable[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
uchar a,b,c,d,e,i,j,k;
delay()
{
for(k=0;k<10;k++)
for(j=0;j<110;j++);
}
void main()
{
TMOD=0x01;
TH0=(65536-5000)/256;
TL0=(65536-5000)%256;
EA=1;
ET0=1;
TR0=1;
while(1)
{
void key();
wei=1;
P0=0xfe;
wei=0;
duan=1;
P0=distable[b];
delay();
wei=1;
P0=0xfd;
wei=0;
duan=1;
P0=xtab[d];
duan=0;
delay();
wei=1;
P0=0xfb;
wei=0;
duan=1;
P0=distable[e];
duan=0;
delay();
}
}
void biao() interrupt 1 using 1
{
TH0=(65536-5000)/256;
TL0=(65536-5000)%256;
a++;
if(a==20)
{
a=0;
i++;
if(i==600)
i=0;
c=i/10;
b=i/100;
d=c%10;
e=i%10;
}
}
void key()
{
P3=0xff;
if(key1==0)
{
delay();
if(key1==0)
{
TR0=~TR0;
while(!key1);
}
}
}