基于单片机万年历的设计毕业设计项目:基于单片机万年历的设计专业:计算机应用技术年级:09级学号:0904040105姓名:赵艳指导老师:鲁晓辉I摘要本文借助电路仿真软件Protues对基于AT89S51单片机的电子万年历的设计方法及仿真进行了全面的阐述。该电子万年历在硬件方面主要采用AT89C51单片机作为主控核心,由DS1302时钟芯片提供时钟、1602LCM点阵液晶显示屏显示。AT89C51单片机是由Atmel公司推出的,功耗小,电压可选用4~6V电压供电;DS1302时钟芯片是美国DALLAS公司推出的具有涓细电流充电功能的低功耗实时时钟芯片,它可以对年、月、日、星期、时、分、秒进行计时,还具有闰年补偿等多种功能,而且DS1302的使用寿命长,误差小;数字显示是采用的LED液晶显示屏来显示,可以同时显示年、月、日、星期、时、分、秒等信息。此外,该电子万年历还具有时间校准等功能。在软件方面,主要包括日历程序、时间调整程序,显示程序等。所有程序编写完成后,在Keil软件中进行调试,确定没有问题后,在Proteus软件中嵌入单片机内进行仿真。论文主要研究了液晶显示器LED及时钟芯片DS1302,温度传感器DS18B20与单片机之间的硬件互联及通信,对数种硬件连接方案进行了详尽的比较,在软件方面对日历算法也进行了论述。研究结果表明,由于万年历的应用相当普遍,所以其设计的核心在于硬件成本的节约软件算法的优化,力求做到物美价廉,才能拥有更广阔的市场前景。关键词:单片机;DS1302;LEDIIAbstractThispapermainlydiscussthedesignandsimulationofelectroniccalenderbasedonAT89S51withthehelpofProtues.Onthehardwareside,theelectroniccalendarusingAT89C51microcontrollerasthemaincontrolcenter,clockprovidedbytheDS1302clockchip,1602LEDdotmatrixLCDdisplay.AtmelCorporationAT89C51microcontrollerisproductedbyAtmelCorporation,lowpowerconsumption,voltagecanbeselected4V~6Vvoltagepowersupply;DS1302clockchip,launchedintheUnitedStateswithDALLASsmallcurrentchargingfunctionrealtimeclockchip,lowpowerconsumption,itcanbeyears,month,date,day,hour,minute,secondstime,alsohasaleapyearcompensationandotherfunctions,andDS1302longlife,smallerror;LEDdigitaldisplayisusedinLCDdisplaysthatcandisplayin,month,day,week,hours,minutes,secondsandotherinformation.Inaddition,theelectroniccalendarisalsoatimecalibrationfunctions.Intermsofsoftware,includingcalendarprogram,timetoadjustprocedures,displayprocedures.Allprogrammingiscomplete,theKeilsoftwaredebugging,makesurethereisnoproblem,intheProteussoftwareembeddedwithinthesimulatedMCU.ThisarticlefocusonliquidcrystalscreenLCM1602andclockchipDS1302,temperaturesensorDS18B20whichconnectedandcommunicatedwithMicrocontroller.Severalsolutionswillalsocomparedwitheachother.Onsoftwareside,calendercalculationwillbediscussedaswell.Theresultsareasfollows:aselectroniccalenderarewidelyusedinourdailylife.Itshouldbechipandconvenientsoastowinmoreprofit.Keywords:Microcontroller,DS1302;DS18B20;LCD1602III目录摘要..........................................................................................................................IAbstract.....................................................................................................................II绪论...........................................................................................................................1第一章方案设计.....................................................................................................2第一节系统基本方案选择和论证...................................................................21.1单片机芯片的选择................................................................................21.2显示模块选择方案和论证...................................................................21.3时钟芯片的选择方案和论证.............................................................21.4温度传感器的选择方案与论证.........................................................3第二节电路设计最终方案决定.......................................................................3第二章系统的硬件设计与实现.............................................................................4第一节电路设计框图.......................................................................................4第二节系统硬件概述.......................................................................................4第三节主要单元电路的设计...........................................................................53.1AT89S51单片机主控制模块的设计....................................................53.2单片机中断系统...................................................................................73.3时钟电路模块的设计............................................................................93.4温度采集模块设计..............................................................................103.5显示模块的设计.................................................................................113.6DS1302原理及说明............................................................................113.7LCM1602工作原理及说明.................................................................14IV3.8系统仿真电路.....................................................................................14第三章系统的软件设计.......................................................................................16第一节程序流程框图.....................................................................................16第二节子程序.................................................................................................18第四章系统测试...................................................................................................194.1硬件测试...................................................................................................194.2软件测试...................................................................................................19结束语.....................................................................................................................20致谢............................................................................................................