基于单片机控制的60秒倒计时实现

1用单片机AT89C51的定时器实现60s倒计时。用两位数码管静态显示倒计时秒值。2用PROTEUS设计,仿真基于AT89c51单片机的60s倒计时实验
邮箱[email protected]

#include<reg52.h>

unsigned char  code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,

0x82,0xf8,0x80,0x90};

unsigned char second=0,minite=6;

void main()

    EA=1;

 ET1=1;

 TMOD=0x10;

 TH1=(65536-50000)/256;

 TL1=(65536-50000)%256;

 TR1=1;

 while(1) ;

}

void time1() interrupt 3 using 1

{

 unsigned char  num;

 TH1=(65536-50000)/256;

 TL1=(65536-50000)%256;

 num++;

 if(num==20)

   {

     num=0;

   if(second==0)

   {

    second=10;

   minite--;

   if(minite==0) minite=6;

   }

  second--;

   }

  P0=table[minite];

  P2=table[second];

}

温馨提示:答案为网友推荐,仅供参考