专业英语结课报告.docx
《专业英语结课报告.docx》由会员分享,可在线阅读,更多相关《专业英语结课报告.docx(8页珍藏版)》请在冰豆网上搜索。
专业英语结课报告
专业英语结课报告
翻译:
基于AT89S51单片机的电子万年历的设计
班级:
10级电子信息统本01班
姓名:
席宇康
学号:
101102010128
摘要
本文借助电路仿真软件Protues对基于AT89S51单片机的电子万年历的设计方法及仿真进行了全面的阐述。
该电子万年历在硬件方面主要采用AT89C51单片机作为主控核心,由DS1302时钟芯片提供时钟、1602LCM点阵液晶显示屏显示。
AT89C51单片机是由Atmel公司推出的,功耗小,电压可选用4~6V电压供电;DS1302时钟芯片是美国DALLAS公司推出的具有涓细电流充电功能的低功耗实时时钟芯片,它可以对年、月、日、星期、时、分、秒进行计时,还具有闰年补偿等多种功能,而且DS1302的使用寿命长,误差小;数字显示是采用的LED液晶显示屏来显示,可以同时显示年、月、日、星期、时、分、秒等信息。
此外,该电子万年历还具有时间校准等功能。
在软件方面,主要包括日历程序、时间调整程序,显示程序等。
所有程序编写完成后,在Keil软件中进行调试,确定没有问题后,在Proteus软件中嵌入单片机内进行仿真。
论文主要研究了液晶显示器LED及时钟芯片DS1302,温度传感器DS18B20与单片机之间的硬件互联及通信,对数种硬件连接方案进行了详尽的比较,在软件方面对日历算法也进行了论述。
研究结果表明,由于万年历的应用相当普遍,所以其设计的核心在于硬件成本的节约软件算法的优化,力求做到物美价廉,才能拥有更广阔的市场前景。
关键词:
单片机;DS1302;LED
绪论
随着社会、科技的发展,人类得知时间,从观太阳、摆钟到现在电子钟,不断研究、创新。
为了在观测时间的同时,能够了解其它与人类密切相关的信息,比如温度、星期、日期等,电子万年历诞生了,它集时间、日期、星期和温度功能于一身,具有读取方便、显示直观、功能多样、电路简洁等诸多优点,符合电子仪器仪表的发展趋势。
伴随着电子技术的迅速发展,特别是随大规模集成电路出现,给人类生活带来了根本性的改变。
由其是单片机技术的应用产品已经走进了千家万户。
电子万年历的出现给人们的生活带来的诸多方便,作为一种附加功能,现在越来越广泛的被应用于各种电子产品中,具有广阔的市场前景。
通过以往对工业自动化的相关课程学习和理解独立完成制作电子万年历的设计。
电子万年历作为电子类小产品不仅是市场上的宠儿,也是是单片机设计培训中一个很实用的题目。
因为这个课题有很好的开放性和可发挥性,对制作者的要求比较高,不仅考察了对单片机的掌握能力更加强调了对单片机扩展的应用。
而且要求设计的电子万年历在操作上力求简洁,功能上尽量齐全,显示界面也要出色。
所以,电子万年历制作无论从实用目的,还是从培养能力的角度来看都是很有价值的毕业设计课题。
本电子万年历的设计在硬件方面主要采用AT89S51单片机作为主控核心,由DS1302时钟芯片提供时钟、1602LCM点阵液晶显示屏显示。
AT89S51单片机是由Atmel公司推出的,功耗小,电压可选用4~6V电压供电[1];DS1302时钟芯片是美国DALLAS公司推出的具有涓细电流充电功能的低功耗实时时钟芯片,它可以对年、月、日、星期、时、分、秒进行计时,还具有闰年补偿等多种功能,而且DS1302的使用寿命长,误差小;数字显示是采用的LED液晶显示屏来显示,可以同时显示年、月、日、星期、时、分、秒等信息。
此外,该电子万年历还具有时间校准等功能。
在软件方面,主要包括日历程序、时间调整程序,显示程序等。
所有程序编写完成后,在Keil软件中进行调试,确定没有问题后,在Proteus软件中嵌入单片机内进行仿真。
最后在老师同学的帮助以及自己的努力下完成了此次电子万年历的设计。
1.1单片机芯片的选择
本设计采用AT89S51芯片作为硬件核心,该芯片采用FlashROM,内部具有4KBROM存储空间,相对于本设计而言程序空间完全够用。
能于3V的超低压工作,而且与MCS-51系列单片机完全兼容,而且运用于电路设计中时具备ISP在线编程技术,当在对电路进行调试时,由于程序的错误修改或对程序的新增功能需要烧入程序时,避免芯片的多次拔插对芯片造成的损坏。
1.2显示模块选择方案和论证
方案一:
采用点阵式数码管显示,点阵式数码管是由八行八列的发光二极管组成,对于显示文字比较适合,如采用在显示数字显得太浪费,且价格也相对较高,所以也不用此种作为显示。
方案二:
采用LED数码管动态扫描,LED数码管价格虽适中,对于显示数字也最合适,而且采用动态扫描法与单片机连接时,占用的单片机口线少。
但是由于数码管动态扫描需要借助74LS164移位寄存器进行移位,该芯片在电路调试时往往会有很多障碍,所以不采用LED数码管作为显示[2]。
方案三:
采用LCD液晶显示屏,液晶显示屏的显示功能强大,可显示大量文字,图形,显示多样,清晰可见[3],对于电子万年历而言,一个1602的液晶屏即可,价格也还能接受,需要的接口线较多,但会给调试带来诸多方便,所以此设计中采用LCD1602液晶显示屏作为显示模块。
1.3时钟芯片的选择方案和论证
方案一:
直接采用单片机定时计数器提供秒信号,使用程序实现年、月、日、星期、时、分、秒计数。
采用此种方案虽然可以减少时钟芯片的使用,节约成本,但是,实现的时间误差较大。
所以不采用此方案。
方案二:
采用DS1302时钟芯片实现时钟,DS130是美国DALLAS公司推出的一种高性能、低功耗、带RAM的实时时钟电路,它可以对年、月、日、周日、时、分、秒进行计时,具有闰年补偿功能,工作电压为2.5V~5.5V。
采用三线接口与CPU进行同步通信,并可采用突发方式一次传送多个字节的时钟信号或RAM数据。
DS1302内部有一个31×8的用于临时性存放数据的RAM寄存器。
DS1302是DS1202的升级产品,与DS1202兼容,但增加了主电源/后背电源双电源引脚,同时提供了对后背电源进行涓细电流充电的能力。
主要特点是采用串行数据传输,可为掉电保护电源提供可编程的充电功能,并且可以关闭充电功能。
采用普通32.768kHz晶振[4]。
因此,本设计中采用DS1302提供时钟。
1.4温度传感器的选择方案与论证
方案一:
使用热敏电阻作为传感器,用热敏电阻与一个相应阻值电阻相串联分压,利用热敏电阻阻值随温度变化而变化的特性,采集这两个电阻变化的分压值,并进行A/D转换。
此设计方案需用A/D转换电路,增加硬件成本而且热敏电阻的感温特性曲线并不是严格线性的,会产生较大的测量误差[5]。
方案二:
采用数字式温度传感器DS18B20,此类传感器为数字式传感器而且仅需要一条数据线进行数据传输,易于与单片机连接,可以避免A/D模数转换模块,降低硬件成本,简化系统电路[6]。
另外,数字式温度传感器还具有测量精度高、测量范围广等优点。
因此,本设计DS18B20温度传感器作为温度采集模块。
Abstract
ThispapermainlydiscussthedesignandsimulationofelectroniccalenderbasedonAT89S51withthehelpofProtues.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.Itshould
bechipandconvenientsoastowinmoreprofit.
Keywords:
Microcontroller,DS1302;DS18B20;LCD1602
Introduction
Withthedevelopmentofsociety,scienceandtechnology,humanthattime,fromtheviewofthesun,theelectronicclockpendulumclocktonow,continuousresearch,innovation.Observationtimeinthesametime,tobeabletounderstandotherinformationrelatedtohuman,suchastemperature,week,date,thebirthoftheelectroniccalendar,itsetthetime,date,weekandtemperaturefunctionsinone,witheasytoread,intuitivedisplay,functionaldiversity,simplecircuitandmanyotheradvantages,inlinewiththedevelopmenttrendofelectronicinstrumentation.Withtherapiddevelopmentofelectronictechnology,especiallywiththeemergenceoflarge-scaleintegratedcircuits,hasbroughtthefundamentalchangetohumanlife.Bytheapplicationofsingle-chipcomputertechnologyproducthavealreadywalkedintothousandsofhouseholds.Theemergenceofelectroniccalendarbringsconveniencetopeople'slife,asanadditionalfunction,nowmoreandmorewidelyusedinvariouselectronicproducts,andhasbroadmarketprospects.
Throughtheindustrialautomationcoursesrelatedtolearningandunderstandingindependentlycompletethedesignofelectroniccalendar.Electroniccalendarasasmallelectronicsproductsisnotonlyamarketdarling,alsoisaverypracticalprobleminchipdesigntraining.Becauseofthissubjecthasgoodopennessandcanplay,theproducersofrelativelyhighrequirements,notonlytheabilitytomasterSCMemphasizestheapplicationofMCUexpansion.Butalsoforthedesignofelectroniccalendarintheoperationisconcise,functiontocomplete,butalsoexcellentdisplayinterface.So,electroniccalendarproducedbothfromapracticalpurpose,orfromthetrainingcapacitypointofviewisthegraduationdesigntopicisveryvaluable.ThedesignoftheelectroniccalendarinhardwareusingAT89S51microcontrollerasthemaincontrolcenter,providedbytheDS1302clockchipclock,1602LCMdotmatrixliquidcrystaldisplay.AT89S51MCUislaunchedbyAtmelcompany,smallpowerconsumption,voltagecanchoose4~6Vvoltagepowersupply;DS1302clockchipisAmericaDALLAScompanyhaslowpowerconsumptionreal-timeclockchipsmalltricklecurrentchargingfunction,itcanbeyears,months,days,week,when,minutesandsecondsforthetime,alsowithaleapyearcompensationandotherfunctions,andtheDS1302'slonglife,smallerror;digitaldisplayisusedtodisplaytheLEDLCDdisplay,candisplayyear,month,day,week,time,minutesandseconds,andotherinformation.Inaddition,theelectroniccalendarisalsoatimecalibrationfunctions.Inthesoftwareaspect,mainlyincludescalendarprogram,timetoadjusttheprogram,displayprogram.Allprogrammingiscomplete,theKeilsoftwaredebugging,makesurethereisnoproblem,microcontrollerembeddedinthesimulationinProteussoftware.Finallyinthehelpofteachersandclassmatesaswellastheirowneffortstocompletethedesignoftheelectroniccalendar.
The1.1singlechipselection
ThisdesignusesAT89S51chipasthecorehardware,thechipusestheFlashROM,with4KBROMinternalstoragespace,relativetothedesignspaceisfullyused.Ultralowvoltagecanworkonthe3V,andisfullycompatiblewiththeMCS-51seriesmicrocontroller,andusedincircuitdesignwithISPprogrammingtechnology,whenthecircuitdebugging,theerrorintheprogramtomodifyortoprogramnewfunctionsneedtobeburnedintheprogram,manytimestoavoiddamagetothechipchippluggingcausedby.
The1.2displaymoduleoptionsandarguments
Plana:
Thedotmatrixdigitaltubedisplay,dotmatrix,digitaltubeiscomposedoflightemittingdiodeeightrowsandeightcolumns,todisplaytextfor,suchastheuseofthedigitaldisplayistoowasteful,andthepriceisrelativelyhigh,sonosuchasshow.
Schemetwo:
TheuseofLEDdigitaltubedynamicscanning,LEDdigitaltube,althoughthepriceismoderate,themostsuitablefordigitaldisplay,andusingdynamicscanningmethodisconnectedwiththeSCM,SCMlinelessoccupied.Butduetothedigitaltubedynamicscanningby74LS164shiftregisterisshifted,thechipinthecircuitdebuggingoftentherewillbemanyobstacles,sodonotuseLEDdigitaltubeasdisplay.
Schemethree:
UsingLCDLCDscreen,LCDscreendisplayfunction,candisplaytext,graphics,displayofdiverse,visible,theelectroniccalendar,a1602LCDscreencanbe,thepricecanaccept,needmoreinterfaceline,butwillbringmuchconveniencetodebugging,thisdesignadoptsLCD1602liquidcrystaldisplayscreenasadisplaymodule.
The1.3Selectionschemeanddemonstratestheclockchip
Plana:
Thechiptimingcounterprovidesasecondsignal,usetheprogramtoachievetheyear,month,day,week,time,minutes,secondscount.Usingthisschemecanreducetheuseoftheclockchip,savethecost,however,thetimeerror.Sodon'tusethisprogram.
Schemetwo:
ToachievetheclockbyclockchipDS1302,DS130isareal-timeclockcircuitisahighperformance,lowpowerconsumption,withRAMAmericanproducedbyDALLAScompany,itcanontheyear,month,day,Sunday,when,minutesandsecondsforthetime,hasaleapyearcompensationfunction,theworkingvoltageis2.5V~5.5V.ThethreelineinterfacesynchronizationwithCPUcommunications,andcanuseburs