课程设计基于单片机的模拟交通灯设计.doc

上传人:文库蛋蛋多 文档编号:4150574 上传时间:2023-04-07 格式:DOC 页数:23 大小:223KB
返回 下载 相关 举报
课程设计基于单片机的模拟交通灯设计.doc_第1页
第1页 / 共23页
课程设计基于单片机的模拟交通灯设计.doc_第2页
第2页 / 共23页
课程设计基于单片机的模拟交通灯设计.doc_第3页
第3页 / 共23页
课程设计基于单片机的模拟交通灯设计.doc_第4页
第4页 / 共23页
课程设计基于单片机的模拟交通灯设计.doc_第5页
第5页 / 共23页
点击查看更多>>
资源描述

《课程设计基于单片机的模拟交通灯设计.doc》由会员分享,可在线阅读,更多相关《课程设计基于单片机的模拟交通灯设计.doc(23页珍藏版)》请在三一办公上搜索。

1、测控技术与仪器专业课程设计 题 目:模拟交通灯的设计 系 别: 机电工程系 班 级: 162902 姓 名: 刘康 张羽翔 赵尉翔 教 师: 王斌 李建勇 目 录一、设计任务3二、模拟交通灯控制系统工作原理32.1 模拟交通灯控制系统的工作原理3三、设计基本要求和步骤43.1 基本要求43.2 设计思路43.2 设计步骤5四、硬件和软件设计54.1 交通灯控制系统硬件框图54.2 硬件电路图74.3 程序流程图8五、心得体会11六、参考文献12七、附录137.1 汇编语言源程序137.2 模拟交通灯仿真效果图16一、 设计任务:模拟交通灯的设计模拟交通灯控制系统的总体方案设计本设计研究的是基于

2、AT89C51单片机的交通灯智能控制系统的设计原理及阐述。主控系统采用AT89C51单片机作为控制器,控制通行倒计时及直行、行人的通行,占用端口少,耗电也最小。系统电源采用独立的+5V稳压电源,有各种成熟电路可供选用,使此方案可靠稳定。该设计精简并优化了电路。结合实际情况,显示界面采用点阵LED数码管动态扫描的方法,满足了倒计时的时间显示输出和状态灯提示信息输出的要求,减少系统的复杂度。二、 交通灯控制系统工作原理 交通灯控制系统工作原理 本系统运用单片机对交通灯控制系统实施控制,通过直接控制信号灯的状态变化,指挥交通的具体运行,运用了LED数码管显示倒计时以提醒行驶者,更添加了盲人提示音电路

3、,方便视力障碍群体通行,更具人性化。在此基础上,加入了特种车辆自动通行控制模块和车流量检测电路为系统采集数据,经单片机进行具体处理,及时调整通行方向。由此,本设计系统以单片机为控制核心,构成最小系统,根据特种车辆自动通行控制模块、车辆检测模块和按键设置模块等产生输入,由信号灯状态模块,LED倒计时模块输出7。系统进入工作状态,LED数码管实时显示数据倒计时,执行交通灯状态显示控制,在此过程中若有控制信号和实时车流量检测信号,可对异常状态进行实时控制,随时调用中断,达到修正通行时间满足不同时间不同路况的需求。三、设计基本要求和步骤十字路口车辆穿梭,行人熙攘,车行车道,人行人道,有条不紊。那么靠什

4、么来实现这井然秩序呢?靠的就是交通信号灯的自动指挥系统。交通信号灯控制方式很多。3.1 基本要求模拟交通灯就是通过AT89C51并接数码管及发光二极管来模拟交通灯的变化规律。8个数码管用来显示秒值,东,西,南,北,各两个。12个发光二极管,东,西,南,北,各三个,分别为红,绿,黄,三种颜色。3.2 设计思路本程序的设计思路是:首先东西方向绿灯亮,南北方向红灯亮,同时开始倒计时20s , 在7段数码管上显示时间。当20s倒计时结束后,开始3s倒计时,并且东西方向绿灯开始闪烁,南北方向红灯亮。当3s倒计时结束后再开始2s倒计时,并且东西方向黄灯亮,南北方向还是红灯亮。当2s倒计时结束后开始20s的

5、倒计时,此时是南北方向绿灯亮,东西方向红灯亮。接下来就是南北方向绿灯闪烁3s,再南北方向黄灯闪烁2s,接着又开始循环。3.3 设计步骤1.利用Proteus 7.5 SP3仿真软件按下列要求绘制仿真实例 12个发光二极管,东,西,南,北,各三个,分别为红,绿,黄,三种颜色。 用8个共阳极LED数码管的分别表示东、西、南、北四个方向路口的秒值。2.按照基本要求编制程序实现相应功能。四、硬件和软件设计4.1 交通灯控制系统硬件框图该交通灯控制系统有以下几个部分组成:单片机、驱示电路。 P1 P3AT89C51 P2.1P2.3RSTP2.4P2.6数码管十位数码管个位LED显示器南北方向LED显示

6、器东西方向上电复位自动/手动键盘图 1.2系统硬件组成总框图AT89C51单片机的主要工作特性:内含4KB的FLASH存储器,擦写次数1000次;内含28字节的RAM;具有32根可编程I/O线;具有2个16位可编程定时器;具有6个中断源、5个中断矢量、2级优先权的中断结构;具有1个全双工的可编程串行通信接口;具有一个数据指针DPTR;两种低功耗工作模式,即空闲模式和掉电模式;具有可编程的3级程序锁定定位;AT89C51的工作电源电压为5(10.2)V且典型值为5V,最高工作频率为24MHz.AT89C51各部分的组成:外部中断TXDRXDP0 P1 P2 P3扩展控制振荡器和时钟电路数据存储器

7、128字节程序存储器14KBCPU两个16位定时器计数器中断控制总线扩展控制器并行可编程I/O口可编程串行口内部总线4.2 硬件电路图整体实验连接电路如下图所示: 图1 整体实验连接电路图主程序 开 始4.3 程序流程图 显示下一个状态秒值是否为0?秒值减1,并显示时间,LED是否到1s?设置定时,显示初始化运行过程SN:绿灯(20),EW:红灯是否到1秒SN:黄灯亮,EW:红灯Count10?SN:黄灯灭,EW:红灯是否到0秒NYYNNEW:绿灯(20),SN:红灯是否到3秒EW:黄灯亮,SN:红灯Count10?EW:黄灯灭,EW:红灯是否到1秒YYYNNNLED显 示区 YLED显示程序

8、ay获取当前通行剩余时间E/S/W/N状态送P1口位选码送P2口倒计时个/十位送P2口调用Delay延时加1两位显示完?YN返回主程序五、心得体会通过这次交通灯的课程设计,使我得到了一次用专业知识、专业技能分析和解决现实问题的能力。使我在单片机的基本原理、单片机应用学习过程中,以及在常用编程设计思路技巧的掌握方面都能向前迈了一大步,为日后成为一名合格的应用型人才打下良好的基础。综合课程设计让我把以前学习到的知识得到巩固和进一步的提高认识,对已有知识有了更深层次的理解和认识。在此,由于自身能力有限,在课程设计中碰到了很多的问题,我通过查阅相关书籍、资料以及和周围同学交流得到解决。还有交通灯是我们

9、生活中非常常见的一种东西,对于我们学以致用的这种能力得到了很好锻炼,能够为我们以后的工作于学习打下基础。由于本人的水平有限,设计中难免会有一些不合理的部分,系统的稳定性还有待提高。最后,对在这个交通灯的课程设计中帮助我的所有同学和各位指导老师再次表示衷心的感谢!六、参考文献【1】李伯成:单片机及嵌入式系统,清华大学出版社,2005【2】胡汉才:单片机原理及接口技术,清华大学出版社,2000【3】张友德:单片机原理与应用,复旦大学出版社,2002【4】牟琦 聂建平:微机原理与接口技术,清华大学出版社,2007【5】张大明:单片机控制实训,机械工业出版社,2007【6】蒋辉平 周国雄:基于Prot

10、eus的单片机系统设计与仿真实例,机械工业出版社,2009七、附录7.1 汇编语言源程序SECONDEQU30HH_REDBIT P2.1;定义IO端口H_GREEN BIT P2.2H_YELLOWBIT P2.3L_RED BIT P2.4L_GREEN BIT P2.5L_YELLOWBIT P2.6 ORG 0000HLJMPMAINORG0030HMAIN: MOV TMOD,#01H;设置定时器0,为方式1 MOV TH0,#3CH;置定时器的初始值,定时50msMOV TL0,#0B0HCLR TF0;清定时器0溢出标志SETB TR0;启动定时器START: CLR AMOV

11、P1,A;首先关闭显示MOV P3,A;*;状态1,东西方向绿灯亮,南北方向红灯亮;*MOV R2,#20 MOV R3,#21MOV SECOND,#20 ;20秒初值LCALL STATE1LCALL COUNT;*;状态2,东西方向绿灯闪,南北方向红灯亮;* MOV R0,#01H;标志位,南北方向绿灯闪 MOV R2,#2MOV R3,#4MOV R4,#10MOV SECOND,#3 ;3秒初值LCALLDISPLAY LCALL STATE2LCALL COUNT1;*;状态3,东西方向黄灯闪,南北方向红灯亮;* MOV R0,#02H;标志位,南北方向黄灯闪 MOV R2,#2M

12、OV R3,#3MOV R4,#10MOV SECOND,#2;2秒初值LCALL STATE3LCALL COUNT1;*;状态4,东西方向红灯亮,南北方向绿灯亮;* MOV R2,#20MOV R3,#21MOV SECOND,#20;20秒初值LCALL STATE4 LCALLCOUNT;*;状态5,东西方向红灯亮,南北方向绿灯闪;* MOV R0,#03H;标志位,东西方向绿灯闪 MOV R2,#2MOV R3,#4MOV R4,#10MOV SECOND,#3;3秒初值 LCALL STATE5LCALL COUNT1;*;状态6,东西方向红亮,南北方向黄灯闪;* MOV R0,#

13、04H;标志位,东西方向黄灯闪 MOV R2,#2MOV R3,#3MOV R4,#10MOV SECOND,#2;2秒初值 LCALL STATE6LCALL COUNT1LJMP START;*;计时程序 ;*COUNT: LCALL DISPLAYWAIT1: JNB TF0,WAIT1;定时器50ms未到,则等待 CLR TF0;定时器50ms到了,;清定时器0溢出标志MOV TH0,#3CHMOV TL0,#0B0HLCALL DISPLAYDJNZ R2,WAIT1;是否到1秒MOV R2,#20DEC SECOND;到1秒则秒值减1DJNZ R3,WAIT1;20秒是否倒计时减完

14、,未完则返回RETCOUNT1: LCALL DISPLAYWAIT2:JNB TF0,WAIT2CLR TF0MOV TH0,#3CHMOV TL0,#0B0HLCALL DISPLAYDJNZ R4,WAIT2;是否到500ms,未到则返回CJNE R0,#01H,D1CPL L_GREEN;到了500ms,则闪南北方向绿灯D1:CJNE R0,#02H,D2CPL L_YELLOW;闪南北方向黄灯D2:CJNE R0,#03H,D3CPL H_GREEN;闪东西方向绿灯D3:CJNE R0,#04H,D4CPL H_YELLOW;闪东西方向黄灯D4:MOV R4,#10DJNZ R2,W

15、AIT2;是否到1秒MOV R2,#2DEC SECONDDJNZ R3,WAIT2RET;*;LED显示状态;*STATE1:SETB H_RED;东西方向绿灯亮,南北方向红灯亮 CLR H_GREENCLR H_YELLOWCLR L_REDSETB L_GREENCLR L_YELLOW.RETSTATE2:CLR H_GREEN;东西方向绿灯闪,南北方向红灯亮CLR H_YELLOWCLR L_REDCLR L_GREENCLR L_YELLOWRETSTATE3:CLR H_RED;东西方向黄灯闪,南北方向红灯亮CLR H_YELLOWSETB H_REDCLR L_GREENSET

16、B L_YELLOWRETSTATE4:CLR H_RED;东西方向红灯亮,南北方向绿灯亮 SETB H_GREENCLR H_YELLOWSETB L_REDCLR L_GREENCLR L_YELLOWRETSTATE5:CLR H_RED;东西方向红灯亮,南北方向绿灯闪 SETB H_GREENCLR H_YELLOW SETB L_REDCLR L_GREENCLR L_YELLOWRETSTATE6:CLR H_RED;东西方向红灯亮,南北方向黄灯闪 CLR H_GREENSETB H_YELLOWSETB L_REDCLR L_YELLOWRET;*;显示程序;*DISPLAY:M

17、OV A,SECOND MOV B,#10DIV AB MOV DPTR,#LEDMAPMOVC A,A+DPTRMOV P1,A;显示十位MOV A,BMOVC A,A+DPTR;显示个位MOV P3,ARETLEDMAP: DB3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FHEND7.2 模拟交通灯仿真效果图如下图所示,AT89C51的P1口分别与数码管的十位ag相连,P3口分别与数码管的个位ag相连。P2.1P2.6分别接东西方向的绿,黄,红LED和南北方向的绿,黄,红LED。正常状态 正常状态的交通灯截图 正常状态秒值电路截图Employment trib

18、unals sort out disagreements between employers and employees.You may need to make a claim to an employment tribunal if: you dont agree with the disciplinary action your employer has taken against you your employer dismisses you and you think that you have been dismissed unfairly.For more information

19、 about dismissal and unfair dismissal, seeDismissal.You can make a claim to an employment tribunal, even if you haventappealedagainst the disciplinary action your employer has taken against you. However, if you win your case, the tribunal may reduce any compensation awarded to you as a result of you

20、r failure to appeal.Remember that in most cases you must make an application to an employment tribunal within three months of the date when the event you are complaining about happened. If your application is received after this time limit, the tribunal will not usually accept it.If you are worried

21、about how the time limits apply to you, take advice from one of the organisations listed underFurther help.Employment tribunals are less formal than some other courts, but it is still a legal process and you will need to give evidence under an oath or affirmation.Most people find making a claim to a

22、n employment tribunal challenging. If you are thinking about making a claim to an employment tribunal, you should get help straight away from one of the organisations listed underFurther help.If you are being represented by a solicitor at the tribunal, they may ask you to sign an agreement where you

23、 pay their fee out of your compensation if you win the case. This is known as adamages-based agreement. In England and Wales, your solicitor cant charge you more than 35% of your compensation if you win the case.If you are thinking about signing up for a damages-based agreement, you should make sure

24、 youre clear about the terms of the agreement. It might be best to get advice from an experienced adviser, for example, at a Citizens Advice Bureau. To find your nearest CAB, including those that give advice by e-mail, click onnearest CAB.For more information about making a claim to an employment tr

25、ibunal, seeEmployment tribunals.The (lack of) air up there Watch mCayman Islands-based Webb, the head of Fifas anti-racism taskforce, is in London for the Football Associations 150th anniversary celebrations and will attend Citys Premier League match at Chelsea on Sunday.I am going to be at the matc

26、h tomorrow and I have asked to meet Yaya Toure, he told BBC Sport.For me its about how he felt and I would like to speak to him first to find out what his experience was.Uefa hasopened disciplinary proceedings against CSKAfor the racist behaviour of their fans duringCitys 2-1 win.Michel Platini, pre

27、sident of European footballs governing body, has also ordered an immediate investigation into the referees actions.CSKA said they were surprised and disappointed by Toures complaint. In a statement the Russian side added: We found no racist insults from fans of CSKA.Age has reached the end of the be

28、ginning of a word. May be guilty in his seems to passing a lot of different life became the appearance of the same day; May be back in the past, to oneself the paranoid weird belief disillusionment, these days, my mind has been very messy, in my mind constantly. Always feel oneself should go to do s

29、omething, or write something. Twenty years of life trajectory deeply shallow, suddenly feel something, do it.一字开头的年龄已经到了尾声。或许是愧疚于自己似乎把转瞬即逝的很多个不同的日子过成了同一天的样子;或许是追溯过去,对自己那些近乎偏执的怪异信念的醒悟,这些天以来,思绪一直很凌乱,在脑海中不断纠缠。总觉得自己自己似乎应该去做点什么,或者写点什么。二十年的人生轨迹深深浅浅,突然就感觉到有些事情,非做不可了。The end of our life, and can meet many t

30、hings really do?而穷尽我们的一生,又能遇到多少事情是真正地非做不可?During my childhood, think lucky money and new clothes are necessary for New Year, but as the advance of the age, will be more and more found that those things are optional; Junior high school, thought to have a crush on just means that the real growth, but

31、over the past three years later, his writing of alumni in peace, suddenly found that isnt really grow up, it seems is not so important; Then in high school, think dont want to give vent to out your inner voice can be in the high school children of the feelings in a period, but was eventually infarct

32、ion when graduation party in the throat, later again stood on the pitch he has sweat profusely, looked at his thrown a basketball hoops, suddenly found himself has already cant remember his appearance.童年时,觉得压岁钱和新衣服是过年必备,但是随着年龄的推进,会越来越发现,那些东西根本就可有可无;初中时,以为要有一场暗恋才意味着真正的成长,但三年过去后,自己心平气和的写同学录的时候,突然就发现是不

33、是真正的成长了,好像并没有那么重要了;然后到了高中,觉得非要吐露出自己的心声才能为高中生涯里的懵懂情愫划上一个句点,但毕业晚会的时候最终还是被梗塞在了咽喉,后来再次站在他曾经挥汗如雨的球场,看着他投过篮球的球框时,突然间发现自己已经想不起他的容颜。Originally, this world, can produce a chemical reaction to an event, in addition to resolutely, have to do, and time.原来,这个世界上,对某个事件能产生化学反应的,除了非做不可的坚决,还有,时间。A persons time, your

34、 ideas are always special to clear. Want, want, line is clear, as if nothing could shake his. Also once seemed to be determined to do something, but more often is he backed out at last. Dislike his cowardice, finally found that there are a lot of love, there are a lot of miss, like shadow really hav

35、e been doomed. Those who do, just green years oneself give oneself an arm injection, or is a self-righteous spiritual.一个人的时候,自己的想法总是特别地清晰。想要的,不想要的,界限明确,好像没有什么可以撼动自己。也曾经好像已经下定了决心去做某件事,但更多的时候是最后又打起了退堂鼓。嫌恶过自己的怯懦,最终却发现有很多缘分,有很多错过,好像冥冥之中真的已经注定。那些曾经所谓的非做不可,只是青葱年华里自己给自己注射的一支强心剂,或者说,是自以为是的精神寄托罢了。At the mome

36、nt, the sky is dark, the air is fresh factor after just rained. Suddenly thought of blue plaid shirt; Those were broken into various shapes of stationery; From the corner at the beginning of deep friendship; Have declared the end of the encounter that havent start planning. Those years, those days o

37、f do, finally, like youth, will end in our life.此刻,天空是阴暗的,空气里有着刚下过雨之后的清新因子。突然想到那件蓝格子衬衫;那些被折成各种各样形状的信纸;那段从街角深巷伊始的友谊;还有那场还没有开始就宣告了终结的邂逅计划那些年那些天的非做不可,终于和青春一样,都将在我们的人生中谢幕。Baumgartner the disappointing news: Mission aborted. r plays an important role in this mission. Starting at the ground, conditions ha

38、ve to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5

39、 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (called the tropopause),e can expect a lot of turbulence.The supersonic descent could happen as early as Sunda.The

40、weatheThe balloon will slowly drift to the edge of space at 120,000 feet ( Then, I would assume, he will slowly step out onto something resembling an Olympic diving platform.Below, the Earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so despite the distance, it will not be like diving into the deep end of a pool. It will be like he is diving into the shallow end. Skydiver preps for the big jumpWhen he jumps, he is expected to rea

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 办公文档 > 其他范文


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号