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

下載本文檔

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

文檔簡介

1、目錄中文摘要·················································

2、··················································

3、··1. 引言···············································&

4、#183;·················································&

5、#183;······12. 設(shè)計任務(wù)及思路·········································&#

6、183;··············································13. 單片機··&

7、#183;·················································&

8、#183;················································33.1 單片

9、機簡介·················································

10、83;···········································33.2 單片機基本結(jié)構(gòu) ····&#

11、183;·················································&#

12、183;······························3 3.3 單片機硬件特性 ·················

13、··················································

14、··················34. 芯片的選擇······························

15、83;·················································

16、83;·············44.1 74LS373以及74LS07芯片簡介································

17、83;··································44.2 8255芯片·············

18、3;·················································

19、3;·······························54.2.1 8255可編程并行接口芯片簡介···············

20、················································54.2.2 8255可

21、編程并行接口芯片方式控制字格式說明·········································54.3 晶閘管·····

22、;··················································

23、;············································75. 交通燈控制原理分析及方案論證···

24、;··················································

25、;············86. 系統(tǒng)硬件設(shè)計····································&

26、#183;·················································&

27、#183;····96.1 總體設(shè)計···········································

28、3;·················································

29、3;··96.2 單片機最小系統(tǒng)·············································

30、3;········································96.2.1 振蕩電路········

31、;··················································

32、;···································96.2.2 復(fù)位電路·············

33、··················································

34、····························106.3 顯示及其驅(qū)動模塊···················

35、3;·················································

36、3;···········116.3.1 鍵盤與狀態(tài)顯示功能····································

37、;·······································116.3.2 倒計時計數(shù)功能········&#

38、183;·················································&#

39、183;······················117. 系統(tǒng)軟件設(shè)計·························

40、83;·················································

41、83;·············127.1 延時程序設(shè)計··································

42、83;·················································

43、83;···127.1.1 計數(shù)器硬件延時············································

44、·····································127.1.2 軟件延時···········

45、··················································

46、······························137.2 時間及信號燈的顯示·················

47、83;·················································

48、83;··········147.2.1 8031并行口的擴展····································

49、83;········································142設(shè)計任務(wù)及思路設(shè)計一個能夠控制十二盞交通信號燈的模擬系統(tǒng)。通過交通信號燈控制系統(tǒng)的設(shè)計。3系統(tǒng)工作受開關(guān)控制

50、,起動開關(guān) ON 則系統(tǒng)工作;起動開關(guān) OFF 則系統(tǒng)停止工作。控制對象如下:東西方向紅燈兩個 , 南北方向紅燈兩個,東西方向黃燈兩個 , 南北方向黃燈兩個,東西方向綠燈兩個 , 南北方向綠燈兩個,圖1 交通信號示意十字路口東西方向和南北方向各裝有直行(包括右拐彎)控制紅、黃、綠交通信號燈(如圖1所示)。還有倒計時顯示器,顯示器用于顯示相應(yīng)方向直行控制當(dāng)前點亮信號燈還要持續(xù)的時間(即剩余時間)。系統(tǒng)中有兩個按鈕啟動和停止,啟動按鈕按下后信號燈系統(tǒng)開始工作,并周而復(fù)始地循環(huán);停止按鈕按下,所有信號燈都熄滅。信號燈的控制規(guī)律如表1所示。即系統(tǒng)啟動后,東西方向先綠燈亮25s,然后綠燈閃爍3s,最后黃

51、燈亮2s,與此同時南北方向紅燈亮30s。南北方向紅燈亮30s后轉(zhuǎn)為先綠燈亮25s,然后綠燈閃爍3s,最后黃燈亮2s,東西向紅燈亮30s。由此周而復(fù)始地循環(huán)。要求采用單片機實現(xiàn)交通燈的控制規(guī)律。表1 信號燈控制規(guī)律東西方向信號綠燈亮綠燈閃爍黃燈亮紅燈亮?xí)r間25s3s2s30s南北方向信號紅燈亮綠燈亮綠燈閃爍黃燈亮?xí)r間30s25s3s2s設(shè)計電路中使用到的主要元器件,單片機芯片、8255芯片和晶閘管。十字路口分四條道,每條道有三個紅綠燈,共十二個。每個紅綠燈由一塊8031芯片單獨控制,我們只設(shè)計一個紅綠燈的燃亮情況,同理根據(jù)燃亮順序設(shè)計其它紅綠燈。然后再組合起來,達到設(shè)計要求。3單片機3.1單片機

52、簡介單片機是一種集成電路芯片,簡稱為單片微型計算機。是采用超大規(guī)模集成電路技術(shù)把具有數(shù)據(jù)處理能力的中央處理器CPU,隨機存儲器RAM,只讀存儲器ROM,多種I0口和中斷系統(tǒng),定時器,計時器等功能,集成在一塊硅片上構(gòu)成的一個小而完善的計算機系統(tǒng)。3.2單片機基本結(jié)構(gòu)單片機由運算器,控制器,存儲器,輸入輸出設(shè)備組成。3.3單片機硬件特性(1)單片機集成度很高,單片機包括CPU、4KB容量的ROM(8031無)、128B容量的RAM、2個16定時計時器、4個8位并行口、全雙工串口行口。(2)單片機系統(tǒng)結(jié)構(gòu)簡單,使用方便,實現(xiàn)了模塊化。(3)單片機可靠性能好,可工作很長時間。(4)處理功能強,速度快4

53、芯片的選擇4.1 74LS373以及74LS07簡介74LS373 是一種帶三態(tài)門的8D鎖存器,其管腳示意圖2如下所示:圖2 74LS373管腳示意圖其中:1D-8D為8個輸入端。1Q-8Q為8個輸出端。LE為數(shù)據(jù)打入端:當(dāng)LE為“1”時,鎖存器輸出狀態(tài)同輸入狀態(tài);當(dāng)LE由“1”變“0”時,數(shù)據(jù)打入鎖存器OE為輸出允許端;當(dāng)OE=0時,三態(tài)門打開;當(dāng)OE=1時,三態(tài)門關(guān)閉,輸出高阻。六驅(qū)動器(OC高壓輸出) 74LS07       Vcc  6A  6Y  5A  5Y&#

54、160; 4A  4          14  13  12  11  10   9   8Y = A    )                  &

55、#160;                 1   2   3   4   5   6   7         7805實現(xiàn)正電壓輸出,負電壓截止。4.2 8255芯片4.2.1 8255可編程并行接口芯片簡介8255可編程并行接口芯片有三個輸入輸出

56、端口,即A口、B口和C口,對應(yīng)于引腳PA7PA0、PB7PB0和PC7PC0。其內(nèi)部還有一個控制寄存器,即控制口。通常A口、B口作為輸入輸出的數(shù)據(jù)端口。C口作為控制或狀態(tài)信息的端口,它在方式字的控制下,可以分成4位的端口,每個端口包含一個4位鎖存器。它們分別與端口AB配合使用,可以用作控制信號輸出或作為狀態(tài)信號輸入。8255的內(nèi)部組成框圖如圖3所示:圖3 8255內(nèi)部組成框圖4.2.2 8255可編程并行接口芯片方式控制字格式說明8255有兩種控制命令字:一個是方式選擇控制字;另一個是C口按位置位復(fù)位控制字。其中C口按位置位復(fù)位控制字方式使用較為繁難,說明也較冗長,故在此不作敘述。方式控制字格

57、式說明如圖4所示:圖4 8255方式控制字方式0:基本輸入輸出方式。適用于三個端口中的任何一個。每一個端口都可以用作輸入或輸出。輸出可被鎖存,輸入不能鎖存。方式0適合于兩種情況:一種是無條件傳送,另一種是查詢方式傳送。方式1:選通輸入輸出方式。這時A口或B口的8位外設(shè)線用作輸入或輸出,C口的4條線中三條用作數(shù)據(jù)傳輸?shù)穆?lián)絡(luò)信號和中斷請求信號。方式2 :雙向選通輸入/輸出方式。只有A口具備雙向選通輸入/輸出方式,8位外設(shè)線用作輸入或輸出。5交通燈控制原理分析與方案論證本設(shè)計以單片機為核心,以LED數(shù)碼管作為倒計時指示,根據(jù)設(shè)計的要求我們考慮了各功能模塊的幾種設(shè)計方案,以求最佳方案,實現(xiàn)實時顯示系統(tǒng)

58、各種狀態(tài),系統(tǒng)還增設(shè)了根據(jù)交通擁擠情況可分別設(shè)置主干道和次干道的通行時間,以提高效率,緩減交通擁擠。系統(tǒng)總體設(shè)計框圖如圖8所示:單片機最小系統(tǒng)倒計時交通燈鍵盤與狀態(tài)顯示圖8 系統(tǒng)總體設(shè)計1電源提供方案為使模塊穩(wěn)定工作,須有可靠電源。本次設(shè)計考慮了兩種電源方案:方案一:采用獨立的穩(wěn)壓電源。此方案的優(yōu)點是穩(wěn)定可靠,且有各種成熟電路可供選用;缺點是各模塊都采用獨立電源,會使系統(tǒng)復(fù)雜,且可能影響電路電平。方案二:采用單片機控制模塊提供電源。該方案的優(yōu)點是系統(tǒng)簡明扼要,節(jié)約成本;缺點是輸出功率不高。綜上所述,選擇第二種方案。2顯示界面方案該系統(tǒng)要求完成倒計時功能?;谏鲜鲈?,本次設(shè)計考慮了兩種方案:方

59、案一:完全采用點陣式LED顯示。這種方案功能強大,可方便的顯示各種英文字符,漢字,圖形等,但實現(xiàn)復(fù)雜,且須完成大量的軟件工作。方案二:完全采用數(shù)碼管顯示。這種方案優(yōu)點是實現(xiàn)簡單,可以完成倒計時功能。缺點是功能較少,只能顯示有限的符號和數(shù)碼字符。根據(jù)本設(shè)計的要求,方案二已經(jīng)滿足了要求,所以本次設(shè)計采用方案二以實現(xiàn)系統(tǒng)的顯示功能。圖10 鍵盤電路6.3.2 倒計時計數(shù)功能本系統(tǒng)使用數(shù)碼管完成倒計時顯示功能。以南北方向為例,數(shù)碼管顯示的數(shù)值從綠燈的設(shè)置時間最大值往下減,每秒鐘減1,一直減到1。然后又從紅燈的設(shè)置時間最大值往下減,一直減到1。接下來又顯示綠燈時間,如此循環(huán)。系統(tǒng)共有4個兩位的LED數(shù)碼管,分別放置在模擬交通燈控制板上的四個路口。各個方向的數(shù)碼管個位(把數(shù)碼管第二位定義為個位,第一位定義為十位)用一根信號線控制,十位用另一根信號線控制。這里采用動態(tài)顯示。LED數(shù)碼管如圖11所示:圖11 LED數(shù)碼管7系統(tǒng)軟件設(shè)計7.1延時程序設(shè)計延時方法可以有兩種一種是利用MCS-51內(nèi)部定

溫馨提示

  • 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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論