基于单片机的简单交通灯设计I密级:页数:信息工程大学毕业设计(论文)题目:基于单片机的简单交通灯设计学员姓名高杨学号20065903029所在单位五系二十四队指导教师王志新完成日期基于单片机的简单交通灯设计II摘要:近年来随着科技的飞速发展,单片机的应用正在不断深入。同时带动传统控制检测技术日益更新。在实时监测和自动控制的单片机应用系统中,单片机往往作为一个核心部件来使用,仅单片机方面的知识是不够的,还应根据具体硬件结构软硬结合,加以完善。十字路口人来人往,车水马龙。若没有一个完善的系统来维持秩序,那么必然会造成极大的混乱:交通瘫痪自不必说,还有可能出现重大事故。那么靠什么来维持秩序,避免以上情况的发生呢?靠的就是交通信号灯的自动控制指挥系统。交通信号灯的控制方式很多。本系统采用MSC-51系列单片机ATSC51和可编程并行I/O接口芯片8255A为中心器件来设计交通灯控制器,实现了能根据实际车流量通过8051芯片的P1口设置红、绿灯点亮时间的功能;红绿灯循环点亮,倒计时剩5秒时黄灯闪烁警示(交通灯信号通过PA口输出,显示时间直接通过8255的PC口输出至双位数码管);车辆闯红灯报警;绿灯时间检测车流量并通过双位数码管显示。本系统实用性强、操作简单、扩展功能强。关键词:单片机交通灯闯红灯检测车流量基于单片机的简单交通灯设计IIIAbstract:Inrecentyears,withtherapiddevelopmentofthescienceandtechnology,theapplicationofSCMismoreandmoreindepth.Atthesametime,traditionaldetectiontechniquestocontrolthegrowingupdate.Intheapplicationofreal-timedetectionandautomaticcontrolsystemofsingle-chip,single-chipisoftenregardasacorecomponent.useingthesingle-chipneednotonlyknowledge,butalsothestructureofhardwareandsoftwareinaccordancewiththespecificcombinationofhardware,tobeimproved.Crossroadsarecrowdedwithpeopleandvehicles.Ifhasn’taconsummatesystermtoregulatethetrafficorders,thetrafficwillbechaos:trafficjamsareunavoidableeventerribleaccidentswillhappen.Sowhatwecanusetoregulatethetrafficordersandavoidthatsituation?Theautomaticcontrolsystemoftafficlightswillachieve.Therearemanywaystocontolthetrafficlights.ThissystemusesMSC-51seriessingle-chipATSC51andprogrammableparallelI/Ointerfacechip8255A-centricdevicedesignedtocontroltrafficlights.ItaccomplishssettingthetimeofredandgreenlightaccordingtothesituationgofthetrfficsurveybyP1portofthe8051chip;keepingtheredandgreenlighttingonrecurring;yellowlightflashingwarningwhenthecountdownhasfivesecondsleft(thetafficlightsignaloutputsbythePAportandtimeindicatingoutputtothe2-decimal-digital-tubebyPCportof8255chip);alarmingwhensomeoneruntheredlight;detecttingthetafficsurveywhengreenlightandindicatingbythe2-decimal-digital-tube.Thissystermispractical,simpleandstrongextensions.Keywords:Single-chip,detectionoftrafficlights,redlight,trafficsurvey基于单片机的简单交通灯设计IV目录1.引言.................................................................................................................................................12.单片机概述...................................................................................................................................23.芯片简介.......................................................................................................................................33.1MCS-51芯片简介..................................................................................................................33.28255芯片简介.........................................................................................................................73.374LS373简介...........................................................................................................................84.系统硬件设计..............................................................................................................................94.1交通管理的方案论证..........................................................................................................94.2系统硬件设计.........................................................................................................................94.2.1系统总框图.........................................................................................................................104.2.2交通灯硬件线路图............................................................................................................104.2.3系统工作原理....................................................................................................................125.控制器的软件设计...................................................................................................................135.14*4键盘输入设定...................................................................................错误!未定义书签。5.2时间及信号灯的显示.........................................................................................................135.2.18051并行口的扩展............................................................................................................135.2.2显示原理:........................................................................................................................135.2.38255PA口输出信号接信号灯:......................................................................................135.2.48255输出信号与数码管的连接:...................................................................................135.2.58255与8051的连接:.....................................................................................................145.3每秒钟的设定...........................................................................................错误!未定义书签。5.4计数器硬件延时......................................................................................错误!未定义书签。5.4.1计数器初值计算................................................................................错误!未定义书签。5.4.2计算公式............................................................................................错误