畢業(yè)設計基于單片機的交通信號燈模擬控制系統(tǒng)設計_第1頁
畢業(yè)設計基于單片機的交通信號燈模擬控制系統(tǒng)設計_第2頁
畢業(yè)設計基于單片機的交通信號燈模擬控制系統(tǒng)設計_第3頁
畢業(yè)設計基于單片機的交通信號燈模擬控制系統(tǒng)設計_第4頁
畢業(yè)設計基于單片機的交通信號燈模擬控制系統(tǒng)設計_第5頁
已閱讀5頁,還剩17頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、單片機應用設計 交通信號燈模擬控制系統(tǒng)設計參賽學生季策 控制科學與工程學院沙躍 控制科學與工程學院黃佳敏 控制科學與工程學院亢延哲 控制科學與工程學院陳志恒 控制科學與工程學院2012年11月12日目 錄1、摘要32、方案論證比較 3 2.1、電源提供方案 3 2.2、數(shù)碼管驅動方案 3 2.3、顯示界面方案 32.4、按鍵輸入方案 43、 系統(tǒng)總體設計 4 3.1芯片的選擇 4 3.2系統(tǒng)設計與結構框圖 4 3.3電路設計 5 3.3.1時間顯示電路5 3.3.2交通燈電路 6 3.3.3按鍵控制電路74、 工作原理及軟件設計 75、 proteus仿真測試結果 86、 附錄(程序)101、

2、 摘要: 本系統(tǒng)由stc89c52單片機為控制器,以74hc595移位寄存器通過串行轉并行驅動兩個兩位數(shù)碼管顯示倒計時。系統(tǒng)包括紅、綠、黃燈顯示功能、led數(shù)碼管顯示時間功能、控制與調時開關、通過鍵盤設置時間功能。 在車輛通行繁忙的十字交叉路口設置的交通燈控制系統(tǒng),其特點是:道路較窄而車流量較大,主干道,支干道的車輛通行時間不等,同時設有道路應急控制。具體的情況是:在正常的情況下,東西干道通行時間為40秒,南北干道通行時間為60秒,每個方向在綠燈轉為紅燈時,要求黃燈先亮5秒鐘,才能變換運行車道。由于各道路車流量不等,能通過手動按鍵控制各燈顯示時間。二、方案論證比較 2.1、電源提供方案 為使模

3、塊穩(wěn)定工作,須有可靠電源。我們考慮了兩種電源方案方案一:采用獨立的穩(wěn)壓電源。這個可以由8705組成的電源電路直接提供5v電壓,此方案的優(yōu)點是穩(wěn)定可靠,且有各種成熟電路可供選用;缺點是各模塊都采用獨立電源,會使系統(tǒng)復雜,且可能影響電路電平。方案二:采用單片機控制模塊提供電源。改方案的優(yōu)點是系統(tǒng)簡明扼要,節(jié)約成本;缺點是輸出功率不高。綜上所述,我們選擇第二種方案。2.2、數(shù)碼管驅動方案數(shù)碼管需要完成倒計時功能,分為東西和南北方向的倒計時,需要占用較多i/o口,為提高i/o口利用率,提出以下三種方案:方案一:用max7219串行轉并行,一個芯片即可控制兩個兩位數(shù)碼管,優(yōu)點是占有i/o口少,硬件連接簡

4、單,但是價格比較昂貴。方案二:數(shù)碼管段選和位選分別直接連接i/o口,優(yōu)點是電路簡單,很容易實現(xiàn)編程控制,缺點是占用過多i/o口,且電流過小,數(shù)碼管顯示不清晰。方案三:用74hc595移位寄存器驅動數(shù)碼管,優(yōu)點是以前接觸過,使用較方便,也能夠實現(xiàn)串行轉并行,占用i/o口也比較少。綜合自己的經(jīng)驗和學習情況,我們選擇了方案三。2.3 、顯示界面方案該系統(tǒng)要求完成倒計時、狀態(tài)燈等功能。方案一:完全采用數(shù)碼管顯示。這種方案只顯示有限的符號和數(shù)碼字苻,無法勝任題目要求。方案二:完全采用點陣式led 顯示。這種方案實現(xiàn)復雜,且須完成大量的軟件工作;但功能強大,可方便的顯示各種英文字符,漢字,圖形等。方案三:

5、采用數(shù)碼管與點陣led 相結合的方法因為設計既要求倒計時數(shù)字輸出,又要求有狀態(tài)燈輸出等,為方便觀看并考慮到現(xiàn)實情況,用數(shù)碼管與led燈分別顯示時間與提示信息。這種方案既滿足系統(tǒng)功能要求,又減少了系統(tǒng)實現(xiàn)的復雜度。權衡利弊,第三種方案可互補一二方案的優(yōu)缺,我們決定采用方案三以實現(xiàn)系統(tǒng)的顯示功能。2.4、按鍵輸入方案題目要求系統(tǒng)能手動設燈亮時間,我們討論了兩種方案:方案一:使用矩陣鍵盤,可以在有限的i/o口上能夠由更多的按鍵控制,可以實現(xiàn)更多功能,但本設計不需要過多按鍵。方案二: 直接在io口線上接上獨立按鍵開關。因為設計時精簡和優(yōu)化了電路,所以剩余的口資源還比較多,我們使用四個按鍵,分別是k1、

6、k2、k3、k4。由于該系統(tǒng)對于交通燈及數(shù)碼管的控制,只用單片機本身的i/o 口就可實現(xiàn),且本身的計數(shù)器及ram已經(jīng)夠用,故選擇方案二3、 系統(tǒng)總體設計3.1芯片的選擇 我們選用的是at89c51單片機,其包含中央處理器(cpu)、程序存儲器(rom)、數(shù)據(jù)存儲器(ram)、定時/計數(shù)器、并行接口、串行接口和中斷系統(tǒng)等幾大單元及數(shù)據(jù)總線、地址總線和控制總線等三大總線。 另外,我們在數(shù)碼管驅動方面選用了74595移位寄存器,大大的節(jié)省了i/o口,簡化了電路結構。3.2系統(tǒng)設計與結構框圖根據(jù)題目要求,本系統(tǒng)主要由數(shù)碼管顯示倒計時模塊、交通燈亮滅模塊,鍵盤控制模塊等構成南北方向 ns g y r東西

7、方向 ew g y r 系統(tǒng)控制電路 按鍵轉換3.3電路設計3.3.1時間顯示電路因為系統(tǒng)要求南北和東西方向的信號燈時間不一樣,所以就通過串轉并的移位寄存器74hc595輸出數(shù)據(jù)的段碼,位選信號用p2口送出,用動態(tài)掃描的方法顯示東西、南北的倒計時間。3.3.2交通燈電路本設計利用單片機的p1口來驅動和控制各種信號燈的燃亮和燃亮時間,在實際中,交通燈的信號燈需要用高電壓控制,在這里我們只是模擬一下它的控制信號,所以我們就只用單片機的信號引腳直接來控制發(fā)光二極管3.3.3按鍵控制電路按鍵電路設計共使用了4個獨立按鍵,其中有key3,key4分別連接在兩個外部中斷接口(into和int1),按下按鍵

8、實現(xiàn)兩個外部中斷,用來處理緊急事故和切換到調節(jié)時間模式,另外兩個按鍵通過按下按鍵向i/o口輸送低電平,在調節(jié)時間模式實現(xiàn)時間的設置,在普通狀態(tài)下用來切換紅綠燈狀態(tài)。本設計通過外部中斷實現(xiàn)了一個按鍵兩種作用的功能。四、工作原理及軟件設計由軟件設置交通燈的初始時間,南北方向通行60秒,東西方向通行40秒,數(shù)碼管采用動態(tài)顯示,p2口送字位選通信號,通過74595實現(xiàn)段選控制,并通過單片機的p1口控制各種信號燈的燃亮與熄滅,采用中斷方式和按鍵掃描實現(xiàn)按鍵的功能??傮w流程圖東西綠燈南北紅燈東西黃燈閃南北紅燈亮東西紅燈南北綠燈東西紅燈亮南北黃燈閃5、 proteus仿真測試結果為測試編程效果,我們利用pr

9、oteus軟件仿真效果如下:1.交通燈控制系統(tǒng)正常運行時仿真圖2交通燈控制系統(tǒng)緊急情況運行時仿真圖緊急情況下,數(shù)碼管顯示時間停止,所有方向的燈都顯示紅燈。3、仿真結果分析仿真實驗實現(xiàn)南北方向車道和東西方向車道兩條交叉道路的車輛交替運行,南北方向(主干道)每次通行時間設為30秒、東西方向通行時間設為20秒,時間可以在程序中修改。同時能夠實現(xiàn)紅燈、黃燈、綠燈狀態(tài)轉換,紅綠燈轉換時間為5秒,轉黃期間黃燈亮。可以準確顯示每個狀態(tài)所剩余的時間,按下禁行普通車輛鍵,東西南北方向都亮紅燈;按下南北放行鍵,南北綠燈亮,東西紅燈亮;按下東西放行鍵,東西綠燈亮,南北紅燈亮;任何時候按下返回鍵,此系統(tǒng)都將回到初始狀

10、態(tài),當緊急狀況出現(xiàn)時,按下緊急開關,可實現(xiàn)主干道和支干道全部禁止通行,允許緊急車輛安全通行。附:程序#includereg51.h#includeintrins.h#define uchar unsigned char#define uint unsigned intvoid delay(uint z);void light(); /紅綠燈函數(shù)void keyscan();void smg();void send(uchar data);/ 串行數(shù)據(jù)輸入void out(void); /并行輸出 uchar sn=10;we=13;y=3;sng=10;weg=8;/sn為南北方向顯示時間,w

11、e為東西方向顯示時間,weg為東西綠燈時間 uchar num=0; state;/紅綠燈狀態(tài)標志uchar code lamp4=0xf3,0xeb,0xde,0xdd; /紅綠燈4種狀態(tài)uchar code duan10=0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f; /led編碼表uchar code wei4=0xfb,0xf7,0xfe,0xfd; /數(shù)碼管位選編碼sbit k1=p36; /開關k1接p36管腳sbit k3=p32; /開關k2接p33管腳,外部中斷0sbit k2=p35; /開關k3接p35管腳sbit k

12、4=p33; /開關k4接p32管腳,外部中斷1sbit w1=p24;/數(shù)碼管位選sbit w2=p25;sbit w3=p26;sbit w4=p27;sbit seg=p20; /段選串行數(shù)據(jù)輸入sbit shcp=p22; /移位時鐘脈沖sbit stcp=p23; /輸出鎖存器控制脈沖/*延時函數(shù)*/void delayms(uint z) uint x,y; for(x=z;x0;x-) for(y=110;y0;y-);/*數(shù)碼管顯示函數(shù)*/void smg() send(duansn%10);w1=1;w2=0;w3=1;w4=1;/顯示南北方向個位 delay(5); sen

13、d(duansn/10); w1=0;w2=1;w3=1;w4=1;/顯示南北方向十位*delay(5); send(duanwe%10);w1=1;w2=1;w3=1;w4=0;/顯示東西方向個位delay(5); send(duanwe/10);w1=1;w2=1;w3=0;w4=1;/顯示東西方向十位delay(5); /*74595接收數(shù)據(jù)函數(shù)*/void send(uchar data) uchar i; for(i=0;i8;i+) shcp=0;seg=data&0x80;data=data=20) sn-;/時間減1 we-; num=0;/重新計數(shù) if(sn=0|we=0)

14、 state+; if(state3) state=0; switch(state) case 0:sn=sng;we=sng+y;break; case 1:sn=y;we=y; break; case 2:sn=weg+y;we=weg;break; case 3:sn=y;we=y; break; g an employment tribunal claiemployment tribunals sort out disagreements between employers and employees.you may need to make a claim to an employm

15、ent 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 about dismissal and unfair dismissal, seedismissal.you can make a claim to an employment tribunal, eve

16、n 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 your failure to appeal.remember that in most cases you must make an application to an employment tribunal

17、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 i.if you are worried about how the time limits apply to you, take advice from one of the organisations listed underfurther he

18、lp.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 an employment tribunal challenging. if you are thinking about making a claim to an employment tribunal, y

19、ou 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 pay their fee out of your compensation if you win the case. this is known as adamages-based agreement.

20、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 youre clear about the terms of the agreement. it might be best to get advice from an experienced advise

21、r, 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 tribunal, seeemployment tribunals.the (lack of) air up there watch mcayman islands-based webb, the head of

22、 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 match tomorrow and i have asked to meet yaya toure, he told bbc sport.for me its about how he felt and i wou

23、ld 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, president of european footballs governing body, has also ordered an immediate investigation into the refere

24、es 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 beginning of a word. may be guilty in his seems to passing a lot of different life became the appearance o

25、f 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 something, or write something. twenty years of life trajectory deeply shallow, suddenly feel something, d

26、o it.一字開頭的年齡已經(jīng)到了尾聲?;蛟S是愧疚于自己似乎把轉瞬即逝的很多個不同的日子過成了同一天的樣子;或許是追溯過去,對自己那些近乎偏執(zhí)的怪異信念的醒悟,這些天以來,思緒一直很凌亂,在腦海中不斷糾纏??傆X得自己自己似乎應該去做點什么,或者寫點什么。二十年的人生軌跡深深淺淺,突然就感覺到有些事情,非做不可了。the end of our life, and can meet many things really do?而窮盡我們的一生,又能遇到多少事情是真正地非做不可?during my childhood, think lucky money and new clothes are nec

27、essary 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 over the past three years later, his writing of alumni in peace, suddenly found that isnt really grow up

28、, 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 infarction when graduation party in the throat, later again stood on the pitch he has sweat profusely, looked a

29、t his thrown a basketball hoops, suddenly found himself has already cant remember his appearance.童年時,覺得壓歲錢和新衣服是過年必備,但是隨著年齡的推進,會越來越發(fā)現(xiàn),那些東西根本就可有可無;初中時,以為要有一場暗戀才意味著真正的成長,但三年過去后,自己心平氣和的寫同學錄的時候,突然就發(fā)現(xiàn)是不是真正的成長了,好像并沒有那么重要了;然后到了高中,覺得非要吐露出自己的心聲才能為高中生涯里的懵懂情愫劃上一個句點,但畢業(yè)晚會的時候最終還是被梗塞在了咽喉,后來再次站在他曾經(jīng)揮汗如雨的球場,看著他投過籃球的球

30、框時,突然間發(fā)現(xiàn)自己已經(jīng)想不起他的容顏。originally, this world, can produce a chemical reaction to an event, in addition to resolutely, have to do, and time.原來,這個世界上,對某個事件能產(chǎn)生化學反應的,除了非做不可的堅決,還有,時間。a persons time, your ideas are always special to clear. want, want, line is clear, as if nothing could shake his. also once

31、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 have been doomed. those who do, just green years oneself give oneself an arm injection, or is a self-righte

32、ous spiritual.一個人的時候,自己的想法總是特別地清晰。想要的,不想要的,界限明確,好像沒有什么可以撼動自己。也曾經(jīng)好像已經(jīng)下定了決心去做某件事,但更多的時候是最后又打起了退堂鼓。嫌惡過自己的怯懦,最終卻發(fā)現(xiàn)有很多緣分,有很多錯過,好像冥冥之中真的已經(jīng)注定。那些曾經(jīng)所謂的非做不可,只是青蔥年華里自己給自己注射的一支強心劑,或者說,是自以為是的精神寄托罷了。at the moment, the sky is dark, the air is fresh factor after just rained. suddenly thought of blue plaid shirt; th

33、ose 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 of do, finally, like youth, will end in our life.此刻,天空是陰暗的,空氣里有著剛下過雨之后的清新因子。突然想到那件藍格子襯衫;那些被折成各種各樣形狀的信紙;那段

34、從街角深巷伊始的友誼;還有那場還沒有開始就宣告了終結的邂逅計劃那些年那些天的非做不可,終于和青春一樣,都將在我們的人生中謝幕。baumgartner the disappointing news: mission aborted. r plays an important role in this mission. starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. t

35、he 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 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 mi

36、les/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 out onto something resembling an olympic diving platform.below, the earth becomes the concrete bottom of

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論