課程設(shè)計基于單片機的模擬交通燈設(shè)計_第1頁
課程設(shè)計基于單片機的模擬交通燈設(shè)計_第2頁
課程設(shè)計基于單片機的模擬交通燈設(shè)計_第3頁
課程設(shè)計基于單片機的模擬交通燈設(shè)計_第4頁
課程設(shè)計基于單片機的模擬交通燈設(shè)計_第5頁
已閱讀5頁,還剩18頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、測控技術(shù)與儀器專業(yè)課程設(shè)計 題 目:模擬交通燈的設(shè)計 系 別: 機電工程系 班 級: 162902 姓 名: 劉康 張羽翔 趙尉翔 教 師: 王斌 李建勇 目 錄一、設(shè)計任務(wù)3二、模擬交通燈控制系統(tǒng)工作原理32.1 模擬交通燈控制系統(tǒng)的工作原理3三、設(shè)計基本要求和步驟43.1 基本要求43.2 設(shè)計思路43.2 設(shè)計步驟5四、硬件和軟件設(shè)計54.1 交通燈控制系統(tǒng)硬件框圖54.2 硬件電路圖74.3 程序流程圖8五、心得體會11六、參考文獻12七、附錄137.1 匯編語言源程序137.2 模擬交通燈仿真效果圖16一、 設(shè)計任務(wù):模擬交通燈的設(shè)計模擬交通燈控制系統(tǒng)的總體方案設(shè)計本設(shè)計研究的是基于

2、at89c51單片機的交通燈智能控制系統(tǒng)的設(shè)計原理及闡述。主控系統(tǒng)采用at89c51單片機作為控制器,控制通行倒計時及直行、行人的通行,占用端口少,耗電也最小。系統(tǒng)電源采用獨立的+5v穩(wěn)壓電源,有各種成熟電路可供選用,使此方案可靠穩(wěn)定。該設(shè)計精簡并優(yōu)化了電路。結(jié)合實際情況,顯示界面采用點陣led數(shù)碼管動態(tài)掃描的方法,滿足了倒計時的時間顯示輸出和狀態(tài)燈提示信息輸出的要求,減少系統(tǒng)的復(fù)雜度。二、 交通燈控制系統(tǒng)工作原理 交通燈控制系統(tǒng)工作原理 本系統(tǒng)運用單片機對交通燈控制系統(tǒng)實施控制,通過直接控制信號燈的狀態(tài)變化,指揮交通的具體運行,運用了led數(shù)碼管顯示倒計時以提醒行駛者,更添加了盲人提示音電路

3、,方便視力障礙群體通行,更具人性化。在此基礎(chǔ)上,加入了特種車輛自動通行控制模塊和車流量檢測電路為系統(tǒng)采集數(shù)據(jù),經(jīng)單片機進行具體處理,及時調(diào)整通行方向。由此,本設(shè)計系統(tǒng)以單片機為控制核心,構(gòu)成最小系統(tǒng),根據(jù)特種車輛自動通行控制模塊、車輛檢測模塊和按鍵設(shè)置模塊等產(chǎn)生輸入,由信號燈狀態(tài)模塊,led倒計時模塊輸出7。系統(tǒng)進入工作狀態(tài),led數(shù)碼管實時顯示數(shù)據(jù)倒計時,執(zhí)行交通燈狀態(tài)顯示控制,在此過程中若有控制信號和實時車流量檢測信號,可對異常狀態(tài)進行實時控制,隨時調(diào)用中斷,達到修正通行時間滿足不同時間不同路況的需求。三、設(shè)計基本要求和步驟十字路口車輛穿梭,行人熙攘,車行車道,人行人道,有條不紊。那么靠什

4、么來實現(xiàn)這井然秩序呢?靠的就是交通信號燈的自動指揮系統(tǒng)。交通信號燈控制方式很多。3.1 基本要求模擬交通燈就是通過at89c51并接數(shù)碼管及發(fā)光二極管來模擬交通燈的變化規(guī)律。8個數(shù)碼管用來顯示秒值,東,西,南,北,各兩個。12個發(fā)光二極管,東,西,南,北,各三個,分別為紅,綠,黃,三種顏色。3.2 設(shè)計思路本程序的設(shè)計思路是:首先東西方向綠燈亮,南北方向紅燈亮,同時開始倒計時20s , 在7段數(shù)碼管上顯示時間。當(dāng)20s倒計時結(jié)束后,開始3s倒計時,并且東西方向綠燈開始閃爍,南北方向紅燈亮。當(dāng)3s倒計時結(jié)束后再開始2s倒計時,并且東西方向黃燈亮,南北方向還是紅燈亮。當(dāng)2s倒計時結(jié)束后開始20s的

5、倒計時,此時是南北方向綠燈亮,東西方向紅燈亮。接下來就是南北方向綠燈閃爍3s,再南北方向黃燈閃爍2s,接著又開始循環(huán)。3.3 設(shè)計步驟1.利用proteus 7.5 sp3仿真軟件按下列要求繪制仿真實例² 12個發(fā)光二極管,東,西,南,北,各三個,分別為紅,綠,黃,三種顏色。² 用8個共陽極led數(shù)碼管的分別表示東、西、南、北四個方向路口的秒值。2.按照基本要求編制程序?qū)崿F(xiàn)相應(yīng)功能。四、硬件和軟件設(shè)計4.1 交通燈控制系統(tǒng)硬件框圖該交通燈控制系統(tǒng)有以下幾個部分組成:單片機、驅(qū)示電路。 p1 p3at89c51 p2.1p2.3rstp2.4p2.6數(shù)碼管十位數(shù)碼管個位led

6、顯示器南北方向led顯示器東西方向上電復(fù)位自動/手動鍵盤圖 1.2系統(tǒng)硬件組成總框圖at89c51單片機的主要工作特性:·內(nèi)含4kb的flash存儲器,擦寫次數(shù)1000次;·內(nèi)含28字節(jié)的ram;·具有32根可編程i/o線;·具有2個16位可編程定時器;·具有6個中斷源、5個中斷矢量、2級優(yōu)先權(quán)的中斷結(jié)構(gòu);·具有1個全雙工的可編程串行通信接口;·具有一個數(shù)據(jù)指針dptr;·兩種低功耗工作模式,即空閑模式和掉電模式;·具有可編程的3級程序鎖定定位;at89c51的工作電源電壓為5(1±0.2)v且

7、典型值為5v,最高工作頻率為24mhz.at89c51各部分的組成:外部中斷txdrxdp0 p1 p2 p3擴展控制振蕩器和時鐘電路數(shù)據(jù)存儲器128字節(jié)程序存儲器14kbcpu兩個16位定時器計數(shù)器中斷控制總線擴展控制器并行可編程i/o口可編程串行口內(nèi)部總線4.2 硬件電路圖整體實驗連接電路如下圖所示: 圖1 整體實驗連接電路圖主程序 開 始4.3 程序流程圖 顯示下一個狀態(tài)秒值是否為0?秒值減1,并顯示時間,led是否到1s?設(shè)置定時,顯示初始化運行過程sn:綠燈(20),ew:紅燈是否到1秒sn:黃燈亮,ew:紅燈count<10?sn:黃燈滅,ew:紅燈是否到0秒nyynnew:

8、綠燈(20),sn:紅燈是否到3秒ew:黃燈亮,sn:紅燈count<10?ew:黃燈滅,ew:紅燈是否到1秒yyynnnled顯 示區(qū) yled顯示程序ay獲取當(dāng)前通行剩余時間e/s/w/n狀態(tài)送p1口位選碼送p2口倒計時個/十位送p2口調(diào)用delay延時加1兩位顯示完?yn返回主程序五、心得體會通過這次交通燈的課程設(shè)計,使我得到了一次用專業(yè)知識、專業(yè)技能分析和解決現(xiàn)實問題的能力。使我在單片機的基本原理、單片機應(yīng)用學(xué)習(xí)過程中,以及在常用編程設(shè)計思路技巧的掌握方面都能向前邁了一大步,為日后成為一名合格的應(yīng)用型人才打下良好的基礎(chǔ)。綜合課程設(shè)計讓我把以前學(xué)習(xí)到的知識得到鞏固和進一步的提高認識

9、,對已有知識有了更深層次的理解和認識。在此,由于自身能力有限,在課程設(shè)計中碰到了很多的問題,我通過查閱相關(guān)書籍、資料以及和周圍同學(xué)交流得到解決。還有交通燈是我們生活中非常常見的一種東西,對于我們學(xué)以致用的這種能力得到了很好鍛煉,能夠為我們以后的工作于學(xué)習(xí)打下基礎(chǔ)。由于本人的水平有限,設(shè)計中難免會有一些不合理的部分,系統(tǒng)的穩(wěn)定性還有待提高。最后,對在這個交通燈的課程設(shè)計中幫助我的所有同學(xué)和各位指導(dǎo)老師再次表示衷心的感謝!六、參考文獻【1】李伯成:單片機及嵌入式系統(tǒng),清華大學(xué)出版社,2005【2】胡漢才:單片機原理及接口技術(shù),清華大學(xué)出版社,2000【3】張友德:單片機原理與應(yīng)用,復(fù)旦大學(xué)出版社,

10、2002【4】牟琦 聶建平:微機原理與接口技術(shù),清華大學(xué)出版社,2007【5】張大明:單片機控制實訓(xùn),機械工業(yè)出版社,2007【6】蔣輝平 周國雄:基于proteus的單片機系統(tǒng)設(shè)計與仿真實例,機械工業(yè)出版社,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;設(shè)置定時器0,為方式1 mov th0,

11、#3ch;置定時器的初始值,定時50msmov tl0,#0b0hclr tf0;清定時器0溢出標(biāo)志setb tr0;啟動定時器start: clr amov p1,a;首先關(guān)閉顯示mov p3,a;*;狀態(tài)1,東西方向綠燈亮,南北方向紅燈亮;*mov r2,#20 mov r3,#21mov second,#20 ;20秒初值lcall state1lcall count;*;狀態(tài)2,東西方向綠燈閃,南北方向紅燈亮;* mov r0,#01h;標(biāo)志位,南北方向綠燈閃 mov r2,#2mov r3,#4mov r4,#10mov second,#3 ;3秒初值lcalldisplay lca

12、ll state2lcall count1;*;狀態(tài)3,東西方向黃燈閃,南北方向紅燈亮;* mov r0,#02h;標(biāo)志位,南北方向黃燈閃 mov r2,#2mov r3,#3mov r4,#10mov second,#2;2秒初值lcall state3lcall count1;*;狀態(tài)4,東西方向紅燈亮,南北方向綠燈亮;* mov r2,#20mov r3,#21mov second,#20;20秒初值lcall state4 lcallcount;*;狀態(tài)5,東西方向紅燈亮,南北方向綠燈閃;* mov r0,#03h;標(biāo)志位,東西方向綠燈閃 mov r2,#2mov r3,#4mov r

13、4,#10mov second,#3;3秒初值 lcall state5lcall count1;*;狀態(tài)6,東西方向紅亮,南北方向黃燈閃;* mov r0,#04h;標(biāo)志位,東西方向黃燈閃 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溢出標(biāo)志mov th0,#3chmov tl0,#0b0hlcall

14、 displaydjnz r2,wait1;是否到1秒mov r2,#20dec second;到1秒則秒值減1djnz r3,wait1;20秒是否倒計時減完,未完則返回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,d

15、3cpl h_green;閃東西方向綠燈d3:cjne r0,#04h,d4cpl h_yellow;閃東西方向黃燈d4:mov r4,#10djnz r2,wait2;是否到1秒mov r2,#2dec seconddjnz r3,wait2ret;*;led顯示狀態(tài);*state1:setb h_red;東西方向綠燈亮,南北方向紅燈亮 clr h_greenclr h_yellowclr l_redsetb l_greenclr l_yellowretstate2:clr h_green;東西方向綠燈閃,南北方向紅燈亮待添加的隱藏文字內(nèi)容3clr h_yellowclr l_redclr

16、l_greenclr l_yellowretstate3:clr h_red;東西方向黃燈閃,南北方向紅燈亮clr h_yellowsetb h_redclr l_greensetb 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

17、 h_red;東西方向紅燈亮,南北方向黃燈閃 clr h_greensetb h_yellowsetb l_redclr l_yellowret;*;顯示程序;*display:mov 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口分別與數(shù)碼管的十位ag相連,p3口分別與數(shù)

18、碼管的個位ag相連。p2.1p2.6分別接?xùn)|西方向的綠,黃,紅led和南北方向的綠,黃,紅led。正常狀態(tài) 正常狀態(tài)的交通燈截圖 正常狀態(tài)秒值電路截圖 tribunal claimemployment tribunals sort out disagreements between employers and employees.you may need to make a claim to an employment tribunal if:· you don't agree with the disciplinary action your employer has ta

19、ken against you· your employer dismisses you and you think that you have been dismissed unfairly.for more information about dismissal and unfair dismissal, see dismissal.you can make a claim to an employment tribunal, even if you haven't appealed against the disciplinary acti

20、on 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 within three months of the date when the event you a

21、re complaining about happened. if your application is received after this time limit, the tribunal will not usually accept it.if you are worried about how the time limits apply to you, take advice from one of the organisations listed under further help.employment tribunals are less formal than

22、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, you should get help straight away from one of

23、the organisations listed under further 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 a damages-based agreement. in england and wales, your solici

24、tor can't 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 you're clear about the terms of the agreement. it might be best to get advice from an experienced adviser, for exam

25、ple, at a citizens advice bureau.  to find your nearest cab, including those that give advice by e-mail, click on nearest cab.for more information about making a claim to an employment tribunal, see employment tribunals.the (lack of) air up there watch mcayman islands-based webb, the

26、head of fifa's anti-racism taskforce, is in london for the football association's 150th anniversary celebrations and will attend city's 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.&quo

27、t;for me it's about how he felt and i would like to speak to him first to find out what his experience was."uefa has opened disciplinary proceedings against cska for the "racist behaviour of their fans" during city's 2-1 win.michel platini, president of european

28、 football's governing body, has also ordered an immediate investigation into the referee's actions.cska said they were "surprised and disappointed" by toure's complaint. in a statement the russian side added: "we found no racist insults from fans of cska."age has reac

29、hed the end of the beginning 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 ones

30、elf should go to do something, or write something. twenty years of life trajectory deeply shallow, suddenly feel something, do it.一字開頭的年齡已經(jīng)到了尾聲?;蛟S是愧疚于自己似乎把轉(zhuǎn)瞬即逝的很多個不同的日子過成了同一天的樣子;或許是追溯過去,對自己那些近乎偏執(zhí)的怪異信念的醒悟,這些天以來,思緒一直很凌亂,在腦海中不斷糾纏??傆X得自己自己似乎應(yīng)該去做點什么,或者寫點什么。二十年的人生軌跡深深淺淺,突然就感覺到有些事情,非做不可了。the end of our life

31、, and can meet many things 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

32、the real growth, but over the past three years later, his writing of alumni in peace, suddenly found that isn't really grow up, it seems is not so important; then in high school, think don't want to give vent to out your inner voice can be in the high school children of the feelings in a per

33、iod, but was eventually infarction 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 can't remember his appearance.童年時,覺得壓歲錢和新衣服是過年必備,但是隨著年齡的推進,會越來越發(fā)現(xiàn),那些東西根本就可有可無;初中時,以為要有一場暗戀才意味

34、著真正的成長,但三年過去后,自己心平氣和的寫同學(xué)錄的時候,突然就發(fā)現(xiàn)是不是真正的成長了,好像并沒有那么重要了;然后到了高中,覺得非要吐露出自己的心聲才能為高中生涯里的懵懂情愫劃上一個句點,但畢業(yè)晚會的時候最終還是被梗塞在了咽喉,后來再次站在他曾經(jīng)揮汗如雨的球場,看著他投過籃球的球框時,突然間發(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)生化學(xué)反應(yīng)的,

35、除了非做不可的堅決,還有,時間。a person's time, your 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

36、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-righteous spiritual.一個人的時候,自己的想法總是特別地清晰。想要的,不想要的,界限明確,好像沒有什么可以撼動自己。也曾經(jīng)好像已經(jīng)下定了決心去做某件事,但更多的時候是最后又打起了退堂鼓。嫌惡過自己的怯懦,最終卻發(fā)現(xiàn)有很多緣分,有很多錯過,好像冥冥之中真的已經(jīng)注定。那些曾經(jīng)所謂的非做不可,只是青蔥年華里自

37、己給自己注射的一支強心劑,或者說,是自以為是的精神寄托罷了。at the moment, 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 haven&#

38、39;t start planning. those years, those days of do, finally, like youth, will end in our life.此刻,天空是陰暗的,空氣里有著剛下過雨之后的清新因子。突然想到那件藍格子襯衫;那些被折成各種各樣形狀的信紙;那段從街角深巷伊始的友誼;還有那場還沒有開始就宣告了終結(jié)的邂逅計劃那些年那些天的非做不可,終于和青春一樣,都將在我們的人生中謝幕。baumgartner the disappointing news: mission aborted. r plays an important role in this

39、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. 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 c

40、limb 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 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

溫馨提示

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

評論

0/150

提交評論