单片机数字钟的设计+包含电路图+c语言程序+mcs-51单片机
时间:10-02
整理:3721RD
点击:
单片机数字钟的设计
开机时,显示12:00:00的时间开始计时;P0.0用来较秒,P0.1用来较分,P0.2用来较时。
C语言原程序:
#include <AT89X52.H>
unsigned char code
dispcode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00};
unsigned char dispbitcode[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char dispbuf[8]={0,0,16,0,0,16,0,0};
unsigned char dispbitcnt;
unsigned char second;
unsigned char minite;
unsigned char hour;
unsigned int tcnt;
unsigned char mstcnt;
unsigned char i,j;
void main(void)
{
TMOD=0x02;
TH0=0x06;
TL0=0x06;
TR0=1;
ET0=1;
EA=1;
while(1)
更多精彩内容请点击http://www.elecfans.com/soft/33/2013/20130522318589.html下载观看~
不错的文档,值得收藏