江苏省联合职业技术学院建湖中专办学点江苏联合职业技术学院五年制高等职业教育毕业设计(论文)设计(论文)课题:基于51单片机模拟出租车计价器的设计与实现办学点江苏省建湖中等专业学校年级2011专业应用电子技术学号118101124姓名韦勇指导教师成德标二○一六年五月江苏省联合职业技术学院建湖中专办学点1目录摘要................................................................................................................................................2ABSTRACT......................................................................................................................................31课程设计任务书.........................................................................................................................41.1课程设计任务.................................................................................................................41.2课程设计方案.................................................................................................................42硬件电路设计................................................................................................................................52.1振荡电路.........................................................................................................................52.2复位电路设计.................................................................................................................62.3键盘接口电路.................................................................................................................62.4显示电路.........................................................................................................................72.4.11602LCD的基本参数及引脚功能......................................................................72.4.2显示模块采用1602液晶显示接口电路...........................................................82.5单片机各引脚功能说明..................................................................................................93软件设计...................................................................................................................................113.1单片机资源使用...........................................................................................................113.2单片机软件模块设计...................................................................................................113.2.1中断子函数.......................................................................................................113.2.2判键子函数.......................................................................................................123.2.3显示子程序.......................................................................................................123.3总程序流程框图...........................................................................................................14总结................................................................................................................................................15参考文献............................................................................................................错误!未定义书签。致谢................................................................................................................................................16附录1元件件清单......................................................................................................................17附录2原理图..............................................................................................................................18附录3程序清单..........................................................................................................................19江苏省联合职业技术学院建湖中专办学点2摘要本设计的是一个基于单片机STC89C52的出租车自动计费设计,附有复位电路,时钟电路,键盘电路等。复位电路是单片机的初始化操作,除了正常的初始化外,为摆脱困境,通过复位电路可以重新开始。时钟电路采用12MHz的晶振,作为系统的时钟源,具有较高的准确性。在上电时字符型液晶1602显示最初的起步价,里程收费,等待时间收费三种收费,通过按键可以调整起步价,里程收费,等待时间收费。通过按键模拟出租车的运行,暂停,停止。在1602液晶上可以显示运行的时间,运行时暂停的时间,通过计算可以得出总共的费用和总的路程。在这里主要是以STC89C52单片机为核心控制器,P1口接1602液晶显示模块。关键字STC89C52;1602液晶;出租车计费器江苏省联合职业技术学院建湖中专办学点3ABSTRACTThedesignisbasedonamonolithicintegratedcircuitSTC89C52taxibillingdesign,withresetcircuit,clockingcircuit,keyboardcircuit.Resetcircuitisinitialized,besidesthenormaloperationoftheinitialdilemma,asaforeigner,throughtheresetcircuitcanstartagain.12MHzadoptstheclockcircuit,asasystemofcrystaloscillator,higherclocksource.Thecharactersinthecrystalthattheinitial1602,charges,feesmileagewaitingtime,threebuttonscanbeadjustedbychargingfees,justwaitingtime,mileage.Throughthesimulationofthetaxi,buttons,stop.SuspensionIntheliquidcrystaldisplaycanrun1602,operationtime,whensuspensioncanbeobtainedbythecomputationofthetotalcost.hereismainlyforthecorecontroller,STC89C52SCMP0mouthafter1602LCDmodule,P1mouthafterthekeys,throughthekeystroke.Keyword:STC89C52;1602LCD;Taxidevices江苏省联合职业技术学院建湖中专办学点41课程设计任务书1.1课程设计任务基于单片机出租车模拟计价器,采用at24c02存储芯片+LCD1602液晶显示等设计而成。用24c02来存储单价,通过按键来模拟增加里程,模拟出租车向前开。通过液晶显示器显示当前的行驶状态、行驶公里、行驶时间时间(时、分、秒)、费用、单价、等信息。可以设置每公里单价,以及夜间单价和白天单价的不同模式,设置后掉电无需重新设置,设置有等待/继续计时模式。计费分行走的里程*单价+等待的时间*价格。1.2课程设计方案方案一:采用数字电子技术,利用555定时芯片构成多谐振荡器,或采用外围的晶振电路作为时钟脉冲信号,采用计数芯片对脉冲尽心脉冲的计数和分频,最后通过译码电路对数据进行译码,将译码所得的数据送给数码管显示,一下是该方案的流程框图,方案一如图1.1所示:图1.1方案一方案二:采用EDA技术,根据层次化设计理论,该设计问题自顶向下可分为分频模块,控制模块计量模块、译码和动态扫描显示模块,其系统框图如图1.2所示:时钟脉冲等待信号公里脉冲计费脉冲计时计费译码数码管显示江苏省联合职业技术