#include
#define uint unsigned int
#define uchar unsigned char
sbit p2_0=P2^0;
sbit p2_2=P2^1;
sbit p2_4=P2^2;
uchar num=11;
uchar tt=0;
uchar bai,shi,ge,bai1,num1;
uchar code table[]=
{~0x3f,~0x06,~0x5b,~0x4f,
~0x66,~0x6d,~0x7d,~0x07,
~0x7f,~0x6f,~0x77,~0x7c,
~0x39,~0x5e,~0x79,~0x71};
void delay(uint z);
void main()
{
TMOD=0x01;//设置守时方法
TH0=(65536-50000)/256;//核算守时时刻
TL0=(65536-50000)%6;
EA=1;// 开总中止
EX0=1;
IT0=1;
ET0=1; //
TR0=1; //敞开0守时器
p2_0=1;
p2_4=1;
p2_2=1;
while(1)
//if(tt==120)
//{tt=0;
//num=10;
//}
//num=12;
shi=num/10;
ge=num;
p2_0=0;
P0=table[shi];
delay(14);
p2_0=1;
p2_2=0;
P0=table[ge];
delay(14);
p2_2=1;
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x–)
for(y=110;y>0;y–);
}
void ds() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%6;
tt++;
}
//void zd() interrupt 0
//{
// num++ ;
//}
声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/ceping/baogao/257949.html