#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
uchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90} ;
uchar a=0,b=0,c=0,d=0,num=0;
void xs();
void main()
{
TH0=(65536-30000)/256;
TL0=(65536-30000)%256;
TMOD=0X01;
EA=1;
ET0=1;
TR0=1;
xs();
while(1)
{
if(num==20)
{ num=0; a++;
if(a==10)
{a=0;b++; }
if(b==10)
{b=0;c++;}
if(c==10)
{c=0;d++;}
if(d==10)
d=0;
xs();
}
}
}
void xs()
{
uchar m,n=1;
for(m=0;m<4;m++)
{ P2=_crol_(n,m);
switch(m)
{
case 0 :P0=table[a];break;
case 1 :P0=table;break;
case 2 :P0=table[c];break;
case 3 :P0=table[d];break;
}
}
}
void time() interrupt 1
{
TH0=(65536-30000)/256;
TL0=(65536-30000)%256;
num++;
}
為什么數(shù)碼管上顯示的是
歡迎光臨 (http://www.raoushi.com/bbs/) | Powered by Discuz! X3.1 |