基于单片机时钟24和12小时制设计
1473下载地址 https://docs.qq.com/doc/DWEpnR2pOWU91b3p4?pub=1&dver=2.1.0
显示格式:hh-mm-ss 可更改的12小时制或24小时制 整点报时功能 闹钟功能 校时功能
#include<reg51.h> char code led_mod[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; int second,min,hour; int setmin=0,sethour=0; int currentmin,currenthour; bit flag=0; bit timeflag=1; bit time24to12=1; bit amorpm=0; sbit P16=P1^6; unsigned char status; void delay(int time) { int i; for(;time>0;time--) for(i=0;i<250;i++); } int0_key() interrupt 0{ flag=1; status=P0; } void sound(int n) {