/*60秒循环*/
#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
uchar num,num1,shi,ge;
uchar code table[ ]={
0x02/*0*/,0x9f/*1*/,0x24/*2*/,
0x0c/*3*/,0x98/*4*/,0x48/*5*/,
0xc0/*6*/,0x1e/*7*/,0x00/*8*/
};/*共阳数码管0 8编码*/
delay(uint x)
{
uint i,j;
for(i=x;i>0;i--)
for(j=125;j>0;j--);
}
void display(uchar shi,uchar ge)
{
P3=0XFE;
P0=table[ge];
delay(10);
P3=0XFd;
P0=table[shi];
delay(10);
}
void main()
{
TMOD=0X01;
TH1=(65535-5000)/ 256;
TL0=(65535-5000)%256;
EA=1;
ET0=1;
TR0=1;
while(1)
{
void display(uchar shi,uchar ge);
}
}
void
time1() interrupt 1
{
TH1=(65535-5000)/ 256;
TL0=(65535-5000)%256;
if(num++==20)
{ num=0;
num1++;
if(num1==60)
num1=0;
shi=num1/10;
ge=num1%10;
}
}
#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
sbit d1=P1^0;
sbit D2=P2^0;
uchar code table[ ]={0x02/*0*/,0x9f/*1*/,0x24/*2*/,0x0c/*3*/,
0x98/*4*/,0x48/*5*/,0xc0/*6*/,0x1e/*7*/,0x00/*8*/};/*共阳数码管0 8编码*/
delay(uint x)
{ uint i,j;
for(i=x;i>0;i--)
for(j=125;j>0;j--);
}
uchar k,g;
void main()
{ D2=1;
EA=1;
EX0=1;
IE0=0;
while(1)
{k=0;
P3=0X00;
for(g=0;g<=8;g++)
{P0=table[g];
delay(50);
}
}
}
void TO1() interrupt 0
{
d1=0;
}
PCB打样找华强 http://www.hqpcb.com 样板2天出货
一周热门 更多>