#include
#define DataPort P0 //界说数据端口 程序中遇到DataPort 则用P0 替换
#define CtrlPort P1 //界说操控端口
unsigned char code DuanMa[10]={0xc0,0xf9,0xa4,0xb0, 0x99,0x92,0x82,0xf8,0x80,0x90};// 显现段码值0~9
unsigned char code WeiMa[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};//别离对应相应的数码管点亮,即位码
unsigned char TempData[8]; //存储显现值的全局变量
void Delay(unsigned int t); //函数声明
void Display(unsigned char FirstBit,unsigned char Num);
unsigned char j,k,flag=1,flag1=1,flag2=1,aa=1,bb=1,cc=1,flag22=1;
unsigned char num=25,num1=30,num11=30,num22=25;
void init()
{
TMOD=0x11;
TH1=(65536-50000)/256;
TL1=(65536-50000)%6;
TH0=(65536-50000)/256;
TL0=(65536-50000)%6;
EA=1;
ET1=1;
ET0=1;
TR1=1;
TR0=1;
}
void main()
{
init();
while(1)
{
{
if(flag==1)
{
if(j==20)
}
}
else
if(j==120)
{
j=0;
num=25;
flag=1;
aa=0;
}
}
if(num==0)
{
if(flag1==1)
{
TR0=0;
flag=0;
TH0=(65536-50000)/256;
TL0=(65536-50000)%6;
TR0=1;
flag1=0;
}
}
if(aa==0)
{
num11=30;
aa=1;
}
}
{
if(num1==-1)
{
bb=0;
num1=30;
}
}
if(bb==0)
{
if(cc==1)
{
if(flag22==1)
{
if(k==20)
}
}
else
if(k==120)
{
k=0;
flag22=1;
num22=25;
flag2=1;
bb=1;
}
}
if(num22==0)
{
if(flag2==1)
{
TR1=0;
flag22=0;
TH1=(65536-50000)/256;
TL1=(65536-50000)%6;
TR1=1;
flag2=0;
}
}
}
}
}
void Delay(unsigned int t)
{
}
void Display(unsigned char FirstBit,unsigned char Num)
{
}
void exter0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%6;
j++;
}
void exter1() interrupt 3
{
TH1=(65536-50000)/256;
TL1=(65536-50000)%6;
k++;
}
声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/zhishi/260885.html