您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 酒店餐饮 > 16-32点阵数字钟及汉字显示
16*32点阵数字钟及汉字显示一.电路原理框架设计制作作品:16×32点阵显示数字钟及汉字显示实现功能:点阵显示的实时时钟以及汉字等字符的左移显示实用特征:采用双电源供电,断电后时钟由电池供电还能继续运行,而且精确性较高实现原理:1.时钟显示是由DS1302精确的时钟芯片产生时钟信号并将其送至单片机,经过单片机处理后再输送到点阵显示模块。2.汉字显示并左移原理是先写入与本点阵驱动相应的代码进单片机,通过单片机控制程序取表进行处理后送点阵模块显示电路主要模块及原理图:1.单片机最小系统及控制按键电路2.DS1302与单片机接口电路DS1302除了系统上电时由系统供电外,如果主电源断电还有一电池给DS1302供电,防止断电后DS1302数据消失。4.点阵行驱动模块电路行驱动采用74LS154(4-16线译码器)及PNP三极管,由于是16×32点阵显示功率较大故采用8550NP三极管。5.点阵列驱动电路列驱动采用74HC595移位寄存器将控制位级连接入单片机,每个74HC595数据输入端单独接单片机。16×32点阵模块由8块小的8×8点阵模块通过级连而拼成,共16行,32列。二:主要元器件选择:单片机:AT89S51采用市场上比较常用的STC89C51三极管:点阵的行驱动电路用,这里采用PNP管,具体型号用8550点阵块:为了电路简单,采用双色8×8点阵晶振:采用的是12MHZ的晶振电源部分:采用5V电压供电,采用的是L7805稳压芯片供电电阻:大部分是限流电阻,阻值为4.7K或10K,1K译码器:4-16线采用市场上较为常用的74LS154,用来作行驱动移位寄存器:采用74HC595移位寄存器作列驱动,驱动列端口分配及连接:P1.0-P1.2:DS1302与单片机接口P1.3-P1.4:K0,K1按键,用来调整时间,按下为0P0:P0口接点阵行驱动电路接译码器P2:P2口点阵列驱动电路接74HC595最后是做好之后的图附:点阵时间显示源程序//===================================================================================////*标题:16*32点阵数字钟显示程序//*说明:时钟信号产生采用DS1302,列采用74HC595驱动(共4个),行驱动采用4-16线译码器74LS154//*功能:通过动态扫描显示时钟,可显示时,分,秒,日期中的月和日//*作者:HEY//*日期:2006-05-29//*邮箱:billy3416@163.com//*备注:此是我刚接触单片机时的一个小制作程序和电路设计上难免有不足之处请谅解//===================================================================================//#includereg51.h#includestdlib.h#defineucharunsignedchar//===================================================================================////用到的引脚及端口定义//===================================================================================//sbitSERIALIN_0=P2^0;//定义P2.0为列向第1个74HC595的DATA输入sbitSERIALIN_1=P2^1;//定义P2.1为列向第2个74HC595的DATA输入sbitSERIALIN_2=P2^2;//定义P2.2为列向第2个74HC595的DATA输入sbitSERIALIN_3=P2^3;//定义P2.3为列向第2个74HC595的DATA输入sbitCLOCK_DATA=P1^0;//定义P1.0为DS1302的DATA端口sbitCLOCK_RST=P1^1;//定义P1.1为DS1302的复位输出端口sbitCLOCK_SCLK=P1^2;//定义P1.2为DS1302的时钟信号状态控制sbitK0=P1^3;//K0为按键1,用来选择要调整时间的选项(时和分)sbitK1=P1^4;//K1为按键2,执行加1sbitCLOCK=P2^4;//74HC595的移位时钟控制sbitLATCH=P2^5;//74HC595的锁存输出时钟控制voidcontrol();//调整时间控制函数voidtime();ucharCLOCK_TIME[3]={0,0,0};//定义时钟时间数据存储区,分别为(时,分,秒)ucharBUFFER[8]={0,0,0,0,0,0,0,0};//显示缓冲区ucharYEAR[3]={0,0,0};//定义时钟年月日数据存储区uchartemp[4]={0,0,0,0};//定义74HC595的移位缓冲区ucharFLASH_STOP;//显示小时和分钟之间的两点控制位ucharsec_flash;//用单片机定时器模拟的一秒(用来控制小时和分中之间的两点)//===================================================================================////定义0-9的点阵显示代码段8*8//===================================================================================//ucharcodebmp[10][8]={{0xe3,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xe3},//0{0xf7,0xc7,0xf7,0xf7,0xf7,0xf7,0xf7,0xc1},//1{0xe3,0xdd,0xdd,0xfd,0xfb,0xf7,0xef,0xc1},//2{0xe3,0xdd,0xfd,0xe3,0xfd,0xfd,0xdd,0xe3},//3{0xfb,0xf3,0xeb,0xdb,0xdb,0xc1,0xfb,0xf1},//4{0xc1,0xdf,0xdf,0xc3,0xfd,0xfd,0xdd,0xe3},//5{0xe3,0xdd,0xdf,0xc3,0xdd,0xdd,0xdd,0xe3},//6{0xc1,0xdd,0xfd,0xfb,0xf7,0xf7,0xf7,0xf7},//7{0xe3,0xdd,0xdd,0xe3,0xdd,0xdd,0xdd,0xe3},//8{0xe3,0xdd,0xdd,0xdd,0xe1,0xfd,0xdd,0xe3},//9};//===================================================================================////定义0-9的点阵显示代码段8*8与上面不同的是多了小时和分钟之间的两点//===================================================================================//ucharcodebmp_1[10][8]={{0xe3,0xdd,0x5d,0xdd,0xdd,0x5d,0xdd,0xe3},//:0{0xf7,0xc7,0x77,0xf7,0xf7,0x77,0xf7,0xc1},//:1{0xe3,0xdd,0x5d,0xfd,0xfb,0x77,0xef,0xc1},//:2{0xe3,0xdd,0x7d,0xe3,0xfd,0x7d,0xdd,0xe3},//:3{0xfb,0xf3,0x6b,0xdb,0xdb,0x41,0xfb,0xf1},//:4{0xc1,0xdf,0x5f,0xc3,0xfd,0x7d,0xdd,0xe3},//:4{0xe3,0xdd,0x5f,0xc3,0xdd,0x5d,0xdd,0xe3},//:5{0xc1,0xdd,0x7d,0xfb,0xf7,0x77,0xf7,0xf7},//:6{0xe3,0xdd,0x5d,0xe3,0xdd,0x5d,0xdd,0xe3},//:7{0xe3,0xdd,0x5d,0xdd,0xe1,0x7d,0xdd,0xe3},//:8};//===================================================================================////定义0-9的点阵显示代码段数码似的字模8*8显示数据前有一横杠将月和日格开//===================================================================================//ucharcodebmp_2[10][8]={{0xff,0xff,0xf8,0xfa,0x8a,0xfa,0xf8,0xff},//-0{0xff,0xff,0xfe,0xfe,0x8e,0xfe,0xfe,0xff},//-1{0xff,0xff,0xf8,0xfe,0x88,0xfb,0xf8,0xff},//-2{0xff,0xff,0xf8,0xfe,0x88,0xfe,0xf8,0xff},//-3{0xff,0xff,0xfa,0xfa,0x88,0xfe,0xfe,0xff},//-4{0xff,0xff,0xf8,0xfb,0x88,0xfe,0xf8,0xff},//-5{0xff,0xff,0xf8,0xfb,0x88,0xfa,0xf8,0xff},//-6{0xff,0xff,0xf8,0xfe,0x8e,0xfe,0xfe,0xff},//-7{0xff,0xff,0xf8,0xfa,0x88,0xfa,0xf8,0xff},//-8{0xff,0xff,0xf8,0xfa,0x88,0xfe,0xf8,0xff},//-9};//===================================================================================////定义0-9的点阵显示代码段模拟数码似的字模8*8//===================================================================================//ucharcodebmp_3[10][8]={{0xff,0xff,0x8f,0xaf,0xaf,0xaf,0x8f,0xff},//0{0xff,0xff,0xef,0xef,0xef,0xef,0xef,0xff},//1{0xff,0xff,0x8f,0xef,0x8f,0xbf,0x8f,0xff},//2{0xff,0xff,0x8f,0xef,0x8f,0xef,0x8f,0xff},//3{0xff,0xff,0xaf,0xaf,0x8f,0xef,0xef,0xff},//4{0xff,0xff,0x8f,0xbf,0x8f,0xef,0x8f,0xff},//5{0xff,0xff,0x8f,0xbf,0x8f,0xaf,0x8f,0xff},//6{0xff,0xff,0x8f,0xef,0xef,0xef,0xef,0xff},//7{0xff,0xff,0x8f,0xaf,0x8f,0xaf,0x8f,0xff},//8{0xff,0xff,0x8f,0xaf,0x8f,0xef,0x8f,0xff},//9};//===================================================================================////定
本文标题:16-32点阵数字钟及汉字显示
链接地址:https://www.777doc.com/doc-3359157 .html