|
程序:
#include <reg52.h>char code tamble[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned int a,num,shi,ge,c,b,n,x=1;
void delay(unsigned int i)
{
int j;
for(i;i>0;i--)
for(j=20;j>0;j--);
}
void init()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
}
void xs(unsigned int m)
{
shi=0;
ge=m;
P3=~tamble[shi];
P2=0X44;
delay(1);
P2=0;
P3=~tamble[ge];
P2=0X88;
delay(1);
P2=0;
}
void main()
{
a=num=shi=ge=c=b=n=0;
init();
{
while(1)
{
if(x%2==0) P0=1;
else P0=2;
if(a==20)
{if(num==9)x++;
num++;
a=0;
if(num==10)
num=0;}
xs(num);
}
}}
void exit() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
a++;
b++;
}
|
-
-
数码管.zip
54.61 KB, 下载次数: 14, 下载积分: 黑币 -5
评分
-
查看全部评分
|