C语言的大神们,加急的程序,希望能够帮我,谢谢!
#include<reg51.h>#define uchar unsigned char
unsigned char tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
unsigned int time=0,time1=25;
sbit com0=P3^0;
sbit com1=P3^1;
sbit key1=P1^0;
sbit key2=P1^1;
sbit key3=P1^2;
sbit D1=P1^3;
sbit D2=P1^4;
int main(void)
{
unsigned char counter;
TOMD=0X01;
TH0=(65536-46083)/256;
TL0=(65536-46083)%256;
TF0=0;
}
void display(unsigned char luo)
{
com0=1;
P2=tab[luo/10];
delay();
com0=0;
com1=1;
P2=tab[luo%10];
delay();
com1=0;
}
void daojishi()
{
time1--;
if(time1==-1) time1=25;
}
void main(void)
{
unsigned char j;
while(1)
{ if(key==1) {time1=25;}
if(key==0)
{
D1=1;D2=0;
daojishi();
for(j=200;j>0;j--)
{display(time1);}
if(time1==0)
{
while(1)
{
com0=1;
com1=1;
delay();
D1=0;
D2=0;
delay();
D1=1;
D2=1;
delay();
if(key==1) break;
}
}
}
{
display(time);
}
}
按照要求需要三个按键分别控制:开始、暂停和复位.我接下来该怎么做?
[此贴子已经被作者于2016-6-8 23:00编辑过]