您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > 单片机60秒倒计时程序
60秒倒计时程序#includereg52.h#defineucharunsignedchar#defineuintunsignedintuchartemp,bai,shi,ge,num;ucharcodetable[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};voiddelay(uint);voidmain(){temp=60;num=0;P2=0x00;TMOD=0x01;TH0=(65536-45872)/256;TL0=(65536-45872)%256;EA=1;ET0=1;TR0=1;while(1){shi=temp/10;ge=temp%10;P0=table[shi];P2=0x02;delay(5);P0=table[ge];P2=0x01;delay(5);}}voidT0_time()interrupt1{TH0=(65536-45872)/256;TL0=(65536-45872)%256;num++;if(num==40){num=0;temp--;if(temp==0){temp=60;}}}voiddelay(uintz){uintx,y;for(x=z;x0;x--)for(y=110;y0;y--);}
本文标题:单片机60秒倒计时程序
链接地址:https://www.777doc.com/doc-4267551 .html