用单片机设计一个时钟,可显示时和分,可以调时间,也要有闹钟功能,要有设...答:其实不用定时中断也能实现功能:include<reg51.h> 主函数 unsigned char tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};定义0-9数组 unsigned int tmp;定义变量 void delay(unsigned int xms)定义延时函数 {unsigned int j,i;for(i=0;i<xms;i++)for(j=0;j<100...
如何用51单片机用单数码管做9s的简易秒表?答:假设P0接数码管,程序如下:include<reg52.h> define uchar unsigned char define uint unsigned int uchar a=0;uchar b=9;//共阴数码管七段码 uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d, 0x07,0x7f,0x6f,0x77};void delay(uchar aa)//延时子程序 { uchar bb,cc;fo...