课程设计基于单片机的模拟交通灯设计_第1页
课程设计基于单片机的模拟交通灯设计_第2页
课程设计基于单片机的模拟交通灯设计_第3页
课程设计基于单片机的模拟交通灯设计_第4页
课程设计基于单片机的模拟交通灯设计_第5页
已阅读5页,还剩18页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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 weathethe balloon will slowly drift to the edge of space at 120,000 feet ( then, i would assume, he will slowly step

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论