|
代码:
#include<reg51.h>
unsigned char LED[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
char gewei;
sbit P17=P1^7;
unsigned char count,second;
void delay(int);
main()
{
EA=1;ET0=1;
TR0=1;
TMOD=0X01;
TH0=-50000>>8;
TL0=-50000;
while(1)
{
P2=0;
P0=LED[second];
delay(1);
}
}
void myT0() interrupt 1
{
TH0=-50000>>8;
TL0=-50000;
count++;
if(count==20)
{
count=0;
second++;
if(second==10)
second=0;
P17=~P17;
}
}
void delay(int x)
{
int i,j;
for(i=0;i<x;i++)
for(j=0;j<120;j++);
}
|
-
-
-
秒表.zip
63.01 KB, 下载次数: 11, 下载积分: 黑币 -5
|