
或者有89c51的数字时钟电路图,源程序,不用74ls也行哇,急急急!
我截个图给你 图好像传不上来 要的话发E-mail给我gianttank@126.com
#include
#include
#define uint unsigned int //宏定义
#define uchar unsigned char //宏定义
sbit dula=P2^6; //数码管段选锁存端
sbit wela=P2^7; ////数码管位选锁存端
uchar code table[]={ //数码管显示编码
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
uchar code point[]={
0xbf,0x86,0xdb,0xcf,
0xe6,0xed,0xfd,0x87,
0xff,0xef,0xf7,0xfc,
0xb9,0xde,0xf9,0xf1};
uchar ct1,ct2,ct3,ct4,ct5,ct6;
void display(uchar,uchar,uchar,uchar,uchar,uchar); //函数声明
void delay(uint);
void main()
{ EA=1;
TMOD=0x01;
ET0=1;
P0=0xff;
TH0=(65536-10)/256;
TL0=(65536-10)%256;
TR0=1;
ct1=ct2=ct3=ct4=ct5=ct6=0;
while(1);
}
void stop() interrupt 1
{ TH0=(65536-10)/256;
TL0=(65536-10)%256;
ct1++;
display(ct6,ct5,ct4,ct3,ct2,ct1);
if(ct1==10)
{ ct1=0;
ct2++;
}
if(ct2==10)
{ ct2=0;
ct3++;
}
if(ct3==10)
{ ct3=0;
ct4++;
}
if(ct4==10)
{ ct4=0;
ct5++;
}
if(ct5==10)
{ ct5=0;
ct6++;
}
if(ct6==10)
{ ct6=0;
}
铅铅
}
void display(uchar one,uchar two,uchar three,uchar four,uchar five,uchar six)
{
者激困 wela=1;
P0=0xfe;
wela=0;
dula=1;
P0=table[one];
dula=0;
delay(1);
P0=0xff;
wela=1;
P0=0xfd;
wela=0;
dula=1;
P0=table[two];
dula=0;
delay(1);
P0=0xff;
wela=1;
P0=0xfb;
wela=0;
dula=1;
P0=table[three];
dula=0;
delay(1);
P0=0xff;
wela=1;
P0=0xf7;
wela=0;
dula=1;
P0=point[four];
dula=0;
delay(1);
P0=0xff;
wela=1;
P0=0xef;
wela=0;
dula=1;
P0=table[five];
dula=0;
delay(1);
P0=0xff;
wela=1;
P0=0xdf;
wela=0;
dula=1;
P0=table[six];
dula=0;
delay(1);
P0=0xff;
}
void delay(uint z) //延时子函数
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
自己改时间