版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、-. z數(shù)字電路與邏輯設(shè)計課程設(shè)計報告題目:電梯控制器的設(shè)計與實現(xiàn)專業(yè):班級:*:*: :分組:完成日期:指導(dǎo)教師:團隊成員:班級*奉獻(xiàn)百分比實驗局部完成情況亮點、完成、根本完成、未完成、時間總分:實驗局部70% + 報告30%檢查教師簽名:目錄課程設(shè)計概述 . 課設(shè)目的 . 課設(shè)要求 . 課設(shè)任務(wù) . 實驗環(huán)境 . 根本方案設(shè)計 . 設(shè)計需求 . 總體構(gòu)造設(shè)計 . 電梯狀態(tài)判斷模塊 . 電梯上下樓控制模塊 . 電梯開關(guān)門模塊 . 電梯升降模塊 . 電梯指示燈模塊 . 電梯數(shù)碼管顯示模塊 . 詳細(xì)設(shè)計 . 電梯狀態(tài)判斷模塊 . 電梯上下樓控制模塊 . 電梯開關(guān)門模塊 . 電梯升降模塊 . 電梯
2、指示燈模塊 . 電梯數(shù)碼管顯示模塊 . 實驗過程與調(diào)試 . 真結(jié)果 . 主要故障與調(diào)試 . 1 課程設(shè)計概述1.1 課設(shè)目的通過硬件描述語言VHDL 的編程,深入了解并掌握可編程芯片PLD 的設(shè)計技術(shù),加強學(xué)生對數(shù)字邏輯課程所學(xué)知識綜合利用的能力。培養(yǎng)學(xué)生創(chuàng)造性思維能力和獨立解決實際問題的能力。1.2 課設(shè)要求能夠全面地應(yīng)用課程中所學(xué)的根本理論和根本方法,完成從設(shè)計邏輯電路到設(shè)計簡單數(shù)字系統(tǒng)的過渡。能力獨立思考、獨立查閱資料,獨立設(shè)計規(guī)定的系統(tǒng)。能夠獨立地完成實施過程,包括安裝、布線、測試和排除故障。1.3 課設(shè)任務(wù)制定出詳細(xì)設(shè)計方案;通過Verilog HDL 完成規(guī)定的設(shè)計任務(wù),然后進展編
3、譯和仿真,保證設(shè)計的正確性;生成容絲圖文件,下載到Basys2 開發(fā)板,通過實際線路進展驗證;對復(fù)雜系統(tǒng)的設(shè)計采取模塊化、層次化的設(shè)計方法;撰寫設(shè)計報告,并對存在的問題進展分析、提出改良意見。1.4 實驗環(huán)境Basys2 開發(fā)板芯片為*C3S100E,封裝為CP1321 套;*ilin*_ISE 設(shè)計仿真軟件 1 套;計算機 1 臺。2 根本方案設(shè)計2.1 設(shè)計需求隨著科學(xué)技術(shù)的開展以及城市化建立,越來越多的高樓林立在城市之間,對于電梯的需求也愈發(fā)強烈。因此,一部平安可靠的電梯逐漸成為人們熱議的話題,而我們要設(shè)計的電梯控制系統(tǒng),能實現(xiàn)各種用戶需求,并且平安可靠,足以適應(yīng)當(dāng)前社會開展的要求。2.
4、2 總體構(gòu)造設(shè)計本電梯控制器系統(tǒng)包含:電梯狀態(tài)判斷模塊電梯上下樓控制模塊電梯開關(guān)門模塊電梯升降模塊電梯指示燈模塊電梯數(shù)碼管顯示模塊共六個模塊。電梯分為以下四個狀態(tài):關(guān)門等待狀態(tài)此時,電梯門關(guān)閉且停在*一樓,等待用戶請求。電梯上行狀態(tài)電梯此刻處于向上運行狀態(tài)。電梯下行狀態(tài)電梯此刻處于向下運行狀態(tài)。開門狀態(tài)此時,電梯門翻開,同時進展關(guān)門倒計時。2.2.1 電梯狀態(tài)判斷模塊該模塊用于獲取電梯此刻的狀態(tài),并根據(jù)用戶請求進展相應(yīng)狀態(tài)轉(zhuǎn)變。輸入:openButton電梯開門按鍵 powerButton電梯電源按鍵 targetFloor用戶請求的目標(biāo)樓層輸出:liftState電梯狀態(tài)2.2.2 電梯上下
5、樓控制模塊該模塊用于獲取用戶請求,判斷電梯是否到達(dá)目標(biāo)樓層以及進展計時器設(shè)置。輸入:powerButton電梯電源鍵resetButton電梯重置按鍵infloorButton1電梯部1 樓按鍵infloorButton3電梯部3 樓按鍵 infloorButton6電梯部6 樓按鍵 infloorButton8電梯部8 樓按鍵outfloorButton1電梯外部1 樓按鍵outfloorButton3電梯外部3 樓按鍵outfloorButton6電梯外部6 樓按鍵outfloorButton8電梯外部8 樓按鍵liftState電梯狀態(tài)輸出:targetFloor目標(biāo)樓層clkFloor
6、電梯樓層間運行速率 clkLight電梯運行燈runTime電梯運行時間2.2.3 電梯開關(guān)門模塊該模塊用于處理用戶開關(guān)門請求并進展關(guān)門倒計時輸入:powerButton電梯電源按鍵 openButton電梯開門按鍵 closeButton電梯關(guān)門按鍵liftState電梯狀態(tài)輸出:doorTime關(guān)門時間doorState電梯門狀態(tài) doorLight電梯門燈2.2.4 電梯升降模塊該模塊進展電梯上升、下降處理輸入:liftState電梯狀態(tài)輸出:currentFloor當(dāng)前樓層2.2.5 電梯指示燈模塊該模塊用于電梯運行時,控制上行燈、下行燈亮與滅輸入:liftState電梯狀態(tài)輸出:up
7、Light電梯上行燈ownLight電梯下行燈 runState電梯運行狀態(tài)2.2.6 電梯數(shù)碼管顯示模塊該模塊用于顯示電梯運行時間、關(guān)門時間、當(dāng)前樓層輸入:currentFloor當(dāng)前樓層runTime運行時間doorTime關(guān)門時間輸出:eightDecode八段數(shù)碼顯示管sevenF、sevenJ、sevenM、sevenK數(shù)碼掃描管顯示2.2.7 總控制模塊電 梯 升 降 模 塊電梯狀態(tài)判斷模塊結(jié)合個子模塊,共同實現(xiàn)電梯功能總 控 制 模 塊電 梯 指 示 燈 模 塊電 梯 上 下 樓 模 塊數(shù) 碼 管 顯 示 模 塊電 梯 開 關(guān) 門 模 塊2.3 詳細(xì)設(shè)計頂層模塊將各個子模塊有機結(jié)
8、合起來,以實現(xiàn)各個功能2.3.1 電梯狀態(tài)判斷模塊本模塊用于處理電梯各種運行狀態(tài)并進展設(shè)置模塊開場 電源鍵開關(guān) 開 關(guān) 電梯置于關(guān)門狀態(tài) 開門鍵 開 電梯處于關(guān)門狀態(tài) 是 電梯置于開門狀態(tài) 關(guān) 電梯處于上升狀態(tài) 否 否 當(dāng)前樓層與目標(biāo)樓層是否相等 是 電梯置于關(guān)門狀態(tài) 電梯運行 2.3.2 電梯上下樓判斷模塊本模塊用于處理用戶樓層請求、以及判斷是否到達(dá)目標(biāo)樓層模塊開場 電源鍵是否翻開 是 否 電梯目標(biāo)樓層請求清空 電梯計時器清零 電梯重置按下 樓層請求只為1樓 其他樓層請求清零 未按 根據(jù)用戶具體樓層按鍵,設(shè)置相應(yīng)樓層請求 電梯到達(dá)指定樓層后,對應(yīng)樓層請求清空 2.3.3 電梯開關(guān)門模塊本模塊
9、用于電梯靜止時運行狀態(tài) 否 是 否 是 是 否 是 模塊開場 電源鍵是否翻開強制開關(guān)翻開并且電梯運行狀態(tài)為開門或靜止 開門指示燈亮,開門狀態(tài)為開,開場5秒倒計時 電梯運動狀態(tài)為翻開強制關(guān)門鍵 開門指示燈滅,倒計時直接置為0 開門指示燈亮, 倒計時5秒 開門指示燈滅,狀態(tài)為關(guān)門狀態(tài)。關(guān)門計時為0 2.3.4 電梯升降模塊 否 是 電梯狀態(tài)為上升 當(dāng)前樓層+1 電梯狀態(tài)為下降 模塊開場 當(dāng)前樓層-1 2.3.5 電梯指示燈模塊本模塊用于指示電梯上下運行狀態(tài) 電梯下行狀態(tài) 否 模塊開場 電梯上行狀態(tài) 否 是 是 上行指示燈滅,下行指示燈亮 上行指示燈亮,下行指示燈滅 上、下下 指 示 燈 均 滅 2
10、.3.6 電梯數(shù)碼管顯示模塊 否 是 掃描分頻 顯示當(dāng)前樓層 電梯狀態(tài)為上升或者下降 顯示樓層間9秒倒計時 電梯狀態(tài)為開門 顯示5秒開門倒計時 模塊開場 實驗過程與調(diào)試2.4.1 模塊部圖1、主模塊輸入:clk:時鐘端powerButton:電源開關(guān) resetButton:重置開關(guān)openButton:強制開門closeButton:強制關(guān)門 infloorButton1:一樓部開關(guān) infloorButton3:三樓部開關(guān) infloorButton6:六樓部開關(guān) infloorButton8:八樓部開關(guān) outfloorButton1:一樓外部開關(guān) outfloorButton3:三樓外
11、部開關(guān) outfloorButton6:六樓外部開關(guān) outfloorButton8:八樓外部開關(guān)輸出:eightDecode:七段顯示譯碼器 flashLight:電梯運行閃爍燈 doorLight:開門顯示燈upLight:上升指示燈floorLight1:一樓指示燈floorLight3:三樓指示燈floorLight6:六樓指示燈floorLight8:八樓指示燈sevenF,sevenJ,sevenM,sevenK:數(shù)碼管掃描指示2.4.2 仿真結(jié)果1、電梯狀態(tài)判斷模塊仿真文件如下:module test; / Inputs reg clk; reg powerButton; reg
12、 resetButton; reg openButton; reg closeButton; reg infloorButton1; reg infloorButton3; reg infloorButton6; reg infloorButton8; reg outfloorButton1; reg outfloorButton3; reg outfloorButton6; reg outfloorButton8; / Outputs wire 7:0 eightDecode; wire flashLight; wire doorLight; wire upLight; wire downL
13、ight; wire floorLight1; wire floorLight3; wire floorLight6; wire floorLight8; wire sevenF; wire sevenJ; wire sevenM; wire sevenK; always begin #5; clk = clk; end always begin #5; infloorButton1 = infloorButton1; end always begin #10; outfloorButton3 = outfloorButton3; end always begin #15; outfloorB
14、utton6 = outfloorButton6; end always begin #20; infloorButton8 = infloorButton8; end initial begin / Initialize Inputs clk = 0; powerButton = 1; resetButton = 0; openButton = 0; closeButton = 0; infloorButton1 = 0; infloorButton3 = 0; infloorButton6 = 0; infloorButton8 = 0; outfloorButton1 = 0; outf
15、loorButton3 = 0; outfloorButton6 = 0; outfloorButton8 = 0; end endmodule 仿真結(jié)果:2、電梯上下樓判斷模塊仿真文件如下: module test; / Inputs reg clk; reg powerButton; reg resetButton; reg openButton; reg closeButton; reg infloorButton1; reg infloorButton3; reg infloorButton6; reg infloorButton8; reg outfloorButton1; reg
16、outfloorButton3; reg outfloorButton6; reg outfloorButton8; / Outputs wire 7:0 eightDecode; wire flashLight; wire doorLight; wire upLight; wire downLight; wire floorLight1; wire floorLight3; wire floorLight6; wire floorLight8; wire sevenF; wire sevenJ; wire sevenM; wire sevenK; always begin #5; clk =
17、 clk; end always begin #5; infloorButton1 = infloorButton1; end always begin #15; outfloorButton3 = outfloorButton3; end always begin #25; outfloorButton6 = outfloorButton6; end always begin #35; infloorButton8 = infloorButton8; end initial begin / Initialize Inputs clk = 0; powerButton = 1; resetBu
18、tton = 0; openButton = 0; closeButton = 0; infloorButton1 = 0; infloorButton3 = 0; infloorButton6 = 0; infloorButton8 = 0; outfloorButton1 = 0; outfloorButton3 = 0; outfloorButton6 = 0; outfloorButton8 = 0; end endmodule 仿真結(jié)果:3、電梯開關(guān)門模塊仿真文件如下:module test; / Inputs reg clk; reg powerButton; reg resetB
19、utton; reg openButton; reg closeButton; reg infloorButton1; reg infloorButton3; reg infloorButton6; reg infloorButton8; reg outfloorButton1; reg outfloorButton3; reg outfloorButton6; reg outfloorButton8; / Outputs wire 7:0 eightDecode; wire flashLight; wire doorLight; wire upLight; wire downLight; w
20、ire floorLight1; wire floorLight3; wire floorLight6; wire floorLight8; wire sevenF; wire sevenJ; wire sevenM; wire sevenK; always begin #5; clk = clk; end always begin #8; openButton = openButton; end always #7 closeButton=closeButton; always #50 infloorButton8=infloorButton8; initial begin / Initia
21、lize Inputs clk = 0; powerButton = 1; resetButton = 0; openButton = 0; closeButton = 0; infloorButton1 = 0; infloorButton3 = 0; infloorButton6 = 0; infloorButton8 = 0; outfloorButton1 = 0; outfloorButton3 = 0; outfloorButton6 = 0; outfloorButton8 = 0; / Wait 100 ns for global reset to finish / Add s
22、timulus here end endmodule 仿真結(jié)果:4、電梯升降模塊仿真文件如下: module test; / Inputs reg clk; reg powerButton; reg resetButton; reg openButton; reg closeButton; reg infloorButton1; reg infloorButton3; reg infloorButton6; reg infloorButton8; reg outfloorButton1; reg outfloorButton3; reg outfloorButton6; reg outfloo
23、rButton8; / Outputs wire 7:0 eightDecode; wire flashLight; wire doorLight; wire upLight; wire downLight; wire floorLight1; wire floorLight3; wire floorLight6; wire floorLight8; wire sevenF; wire sevenJ; wire sevenM; wire sevenK; always begin #5; clk = clk; end always #10 infloorButton8=infloorButton
24、8; always #100 infloorButton3=infloorButton3; initial begin / Initialize Inputs clk = 0; powerButton = 1; resetButton = 0; openButton = 0; closeButton = 0; infloorButton1 = 0; infloorButton3 = 0; infloorButton6 = 0; infloorButton8 = 0; outfloorButton1 = 0; outfloorButton3 = 0; outfloorButton6 = 0; o
25、utfloorButton8 = 0; / Wait 100 ns for global reset to finish / Add stimulus here end endmodule 仿真結(jié)果:5、電梯指示燈模塊仿真文件如下:module test; / Inputs reg clk; reg powerButton; reg resetButton; reg openButton; reg closeButton; reg infloorButton1; reg infloorButton3; reg infloorButton6; reg infloorButton8; reg ou
26、tfloorButton1; reg outfloorButton3; reg outfloorButton6; reg outfloorButton8; / Outputs wire 7:0 eightDecode; wire flashLight; wire doorLight; wire upLight; wire downLight; wire floorLight1; wire floorLight3; wire floorLight6; wire floorLight8; wire sevenF; wire sevenJ; wire sevenM; wire sevenK; alw
27、ays begin #5; clk = clk; end always begin #20; infloorButton3 = infloorButton3; end always begin #40; infloorButton6 = infloorButton6; end always begin #80; outfloorButton8 = outfloorButton8; end initial begin / Initialize Inputs clk = 0; powerButton = 1; resetButton = 0; openButton = 0; closeButton
28、 = 0; infloorButton1 = 0; infloorButton3 = 0; infloorButton6 = 0; infloorButton8 = 0; outfloorButton1 = 0; outfloorButton3 = 0; outfloorButton6 = 0; outfloorButton8 = 0; / Wait 100 ns for global reset to finish / Add stimulus here end endmodule 仿真結(jié)果:6、電梯數(shù)碼管顯示模塊仿真文件如下:module test; / Inputs reg clk; r
29、eg powerButton; reg resetButton; reg openButton; reg closeButton; reg infloorButton1; reg infloorButton3; reg infloorButton6; reg infloorButton8; reg outfloorButton1; reg outfloorButton3; reg outfloorButton6; reg outfloorButton8; / Outputs wire 7:0 eightDecode; wire flashLight; wire doorLight; wire
30、upLight; wire downLight; wire floorLight1; wire floorLight3; wire floorLight6; wire floorLight8; wire sevenF; wire sevenJ; wire sevenM; wire sevenK; always begin #5; clk = clk; end always #10 infloorButton6=infloorButton6; initial begin / Initialize Inputs clk = 0; powerButton = 1; resetButton = 0;
31、openButton = 0; closeButton = 0; infloorButton1 = 0; infloorButton3 = 0; infloorButton6 = 0; infloorButton8 = 0; outfloorButton1 = 0; outfloorButton3 = 0; outfloorButton6 = 0; outfloorButton8 = 0; / Wait 100 ns for global reset to finish / Add stimulus here end endmodule 仿真結(jié)果:2.4.3 主要故障與調(diào)試1故障1 問題描述:
32、3、6兩層電梯外按鍵未設(shè)置上下行按鍵,導(dǎo)致電梯不能完成如電梯1樓,3樓下,6樓上這樣的問題解決方法:增加 3樓上下,6樓上下按鍵,以同向較近優(yōu)先,反向較遠(yuǎn)優(yōu)先2.5 功能測試2.5.1 電梯初始狀態(tài)功能測試圖2.5.1 電梯初始狀態(tài)模塊測試功能測試:翻開電源,顯示當(dāng)前樓層為一樓。翻開強制開門開關(guān),開門燈亮,倒計時5秒2.5.2 電梯上升模塊功能測試圖2.5.2 電梯上升模塊測試功能測試:如圖,翻開電源,按下6 樓按鈕,6 樓指示燈亮,上行指示燈亮,當(dāng)前樓層為4 樓,每層樓之間進展9 秒倒計時,此時倒計時進展至7 秒。每層樓之間運行指示燈閃爍9 下。3.3 仿真與測試3 總結(jié)與心得4.1 課設(shè)總
33、結(jié)為了實現(xiàn)電梯控制器系統(tǒng)的功能要求,作了如下幾點工作:前期對頂層模塊和子模塊做了劃分,確定了頂層模塊對子模塊的控制每當(dāng)完成一個子模塊時,便進展仿真測試,查找錯漏的地方后期上開發(fā)板調(diào)試時,仔細(xì)斟酌各模塊設(shè)計是否合理,并根據(jù)實際情況進展修改4.2 課設(shè)心得本次課程設(shè)計,加強了對上學(xué)期所學(xué)知識的理解,意識到理論對實踐的重要性,也培養(yǎng)了和同學(xué)的交流協(xié)作能力。而設(shè)計中所存在的缺陷,讓自己意識到自己分析設(shè)計的缺乏。同時,對verilog語言的學(xué)習(xí)和運用,也讓自己意識到在編程能力仍需要提高。附錄源程序.v 文件module main(input wire clk, / 時鐘信號input wire powe
34、rButton, / 電源開關(guān)input wire resetButton, /重置開關(guān)input wire openButton, / 強制開門input wire closeButton, / 強制關(guān)門input wire infloorButton1, / 一樓部開關(guān)input wire infloorButton3, / 三樓部開關(guān)input wire infloorButton6, / 六樓部開關(guān)input wire infloorButton8, / 八樓部開關(guān)input wire outfloorButton1, / 一樓外部開關(guān)input wire outfloorButton
35、3, / 三樓外部開關(guān)input wire outfloorButton6, / 六樓外部開關(guān)input wire outfloorButton8, / 八樓外部開關(guān)output reg7:0 eightDecode, / 七段顯示譯碼器output wire flashLight, / 電梯運行閃爍燈output wire doorLight, / 開門顯示燈output reg upLight, / 上升指示燈output reg downLight, / 下降指示燈output wire floorLight1, / 一樓指示燈output wire floorLight3, / 三樓指
36、示燈output wire floorLight6, / 六樓指示燈output wire floorLight8, / 八樓指示燈output reg sevenF, output reg sevenJ, output reg sevenM, output reg sevenK ); reg3:0 currentFloor; / 電梯當(dāng)前樓層reg3:0 targetFloor; / 目標(biāo)樓層,1 代表當(dāng)前樓層有請求reg1:0 liftState; / 電梯運行狀態(tài) 0.關(guān)門等待狀態(tài) 1.上升狀態(tài) 2. 下降狀態(tài) 3.開門狀態(tài)reg mark; / 用于周期滯后wire doorState
37、; / 電梯門開關(guān)狀態(tài),0 為關(guān)門,1 為開門reg runState; / 電梯最近運動狀態(tài),1 為上升,0 為下降reg2:0 doorTime; reg clkFloor; / 電梯上下樓層速率reg clkLight; / 電梯運行時指示燈閃爍頻率 reg scan; reg3:0 runTime; /電梯運行時間顯示 integer q,qLight,qScan,qRun; reg28:0 cTime; / 電梯關(guān)門計時器 initial / 初始化begin q = 0;qLight = 0; qScan = 0; qRun = 0; cTime = 0; runState = 1
38、; / 電梯初始化上升liftState = 0; / 電梯初始化狀態(tài)currentFloor = 1; / 當(dāng)前樓層初始化為 1 樓targetFloor0 = 0; / 目標(biāo)樓層均初始化為無請求targetFloor1 = 0; targetFloor2 = 0; targetFloor3 = 0; clkFloor = 0; clkLight = 0;runTime = 0;scan = 0;sevenF = 0;sevenJ = 1; sevenM = 1; sevenK = 1; doorTime = 0;end / 綁定將目標(biāo)樓層綁定至相應(yīng) LED 燈上assign floorLi
39、ght1 = targetFloor0; assign floorLight3 = targetFloor1; assign floorLight6 = targetFloor2; assign floorLight8 = targetFloor3; assign doorLight = (cTime = 286870911 | cTime = 0) 0 : 1; assign doorState = (cTime = 286870911 | cTime = 0) 0 : 1; assign flashLight = clkLight; / module - Statue Judge alwa
40、ys (posedge clk) begin if(powerButton = 1 & openButton = 1 & liftState = 0) begin liftState = 3; mark = 0;end else if(powerButton = 1 & (liftState = 0 | liftState = 1 | liftState = 2) begin case(currentFloor) 1: begin if(targetFloor0) begin liftState = 3; mark = 0; end else if(targetFloor1 | targetF
41、loor2 | targetFloor3) begin liftState = 1; end end 3: begin if(targetFloor1) begin liftState = 3; mark = 0; end else if(targetFloor0 | targetFloor2 | targetFloor3) begin if(runState = 0 & targetFloor0) begin liftState = 2; end else if(runState = 1 & (targetFloor2 | targetFloor3) beginliftState = 1;
42、end else if(targetFloor0) begin liftState = 2; end else if(targetFloor2 | targetFloor3) begin liftState = 1; end end end 6: begin if(targetFloor2) begin liftState = 3; mark = 0; end else if(targetFloor0 | targetFloor1 | targetFloor3) begin if(runState = 1 & targetFloor3) begin liftState = 1; end els
43、e if(runState = 0 & (targetFloor0 | targetFloor1) begin liftState = 2; end else if(targetFloor3) begin liftState = 1; end else if(targetFloor0 | targetFloor1) begin liftState = 2; end end end 8: begin if(targetFloor3) begin liftState = 3; mark = 0; end else if(targetFloor0 | targetFloor1 | targetFlo
44、or2) begin liftState = 2; end end default: begin if(runState = 0) liftState = 2; else liftState = 1; end endcase end else begin if(mark = 1) begin if(doorState = 0) begin liftState = 0; end end else begin mark = 1; end end end / / /module - Control System always (posedge clk) begin if(powerButton =
45、1) / 電梯運行開關(guān)翻開begin / 計時器 if(liftState = 1 | liftState = 2) begin if(q = 225000000) begin clkFloor = clkFloor; q = 0; end elsebegin q = q + 1; end if(qLight = 25000000) begin clkLight = clkLight; qLight = 0; end else begin qLight = qLight + 1; end if(runTime = 0) begin runTime = 9; end if(qRun = 5000
46、0000) begin runTime = runTime - 1; qRun = 0;end elsebegin qRun = qRun + 1; end end else begin q = 0; clkLight = 0; end / 判斷用戶請求if(resetButton = 1) begin targetFloor0 = 1;targetFloor1 = 0;targetFloor2 = 0; targetFloor3 = 0; endelsebegin if(infloorButton1 | outfloorButton1)targetFloor0 = 1; if(infloor
47、Button3 | outfloorButton3)targetFloor1 = 1;if(infloorButton6 | outfloorButton6)targetFloor2 = 1; if(infloorButton8 | outfloorButton8)targetFloor3 = 1; end / 判斷是否到達(dá)目標(biāo)樓層 if(currentFloor = 1 & targetFloor0) targetFloor0 = 0; if(currentFloor = 3 & targetFloor1) targetFloor1 = 0; if(currentFloor = 6 & ta
48、rgetFloor2) targetFloor2 = 0; if(currentFloor = 8 & targetFloor3) targetFloor3 = 0; end else if(powerButton = 0) begin q = 0; targetFloor0 = 0; targetFloor1 = 0; targetFloor2 = 0; targetFloor3 = 0; end end / 電梯狀態(tài)控制-靜止情況always (posedge clk) beginif(powerButton = 1) begin if(openButton = 1 & (liftStat
49、e = 0 | liftState = 3) begin cTime = -1; / 強制賦值,使 cTime 最高位置為 1 doorTime = 5; end else if(liftState = 3) begin if(closeButton = 1) begin cTime = 0;doorTime = 0;endelsebegincTime = 486870911)doorTime = 436870911)doorTime = 386870911) doorTime = 336870911) doorTime = 286870911) doorTime = 1;else doorT
50、ime = 0; end else begin cTime = 0; end end else begin cTime = 0; end end / 電梯狀態(tài)控制-電梯升降always (negedge clkFloor begin if(liftState = 1) begin currentFloor = currentFloor + 1; end else if(liftState = 2) begin currentFloor = currentFloor - 1; endend / / / module - Statue Display / 電梯升降指示燈always (posedg
51、e clk) begin if(liftState = 1) begin upLight = 1; downLight = 0; runState = 1; end else if(liftState = 2) begin upLight = 0; downLight = 1; runState = 0; end else begin upLight = 0; downLight = 0; end end /數(shù)碼管顯示always (posedge clk) begin if(qScan = 100000) begin scan = scan; qScan = 0; end else begi
52、n qScan = qScan + 1; end end always (posedge scan) begin sevenF = sevenF; sevenJ = sevenJ; sevenM = 1; sevenK = 1; if(sevenF = 0) begin case(currentFloor) 1: eightDecode = 8b10011111; 2: eightDecode = 8b00100101; 3: eightDecode = 8b00001101; 4: eightDecode = 8b10011001; 5: eightDecode = 8b01001001; 6: eightDecode = 8b01000001; 7: eightDecode = 8b00011111; 8: eightDecode = 8b00000001; default: eightDecode = 8b11111111; endcase end else if(sevenJ = 0 & (liftState = 1 | liftState = 2) begin cas
溫馨提示
- 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)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024-2030年中國行李拖車行業(yè)銷售狀況與需求趨勢預(yù)測報告
- 2024-2030年中國蜜柑油產(chǎn)業(yè)未來發(fā)展趨勢及投資策略分析報告
- 2024-2030年中國茶葉行業(yè)市場競爭格局及投資規(guī)模分析報告
- 2024-2030年中國舞蹈服裝行業(yè)市場競爭趨勢及投資營銷模式分析報告
- 2024-2030年中國脫脂劑防銹劑除銹劑行業(yè)市場發(fā)展規(guī)模及投資可行性分析報告
- 2024-2030年中國聚合支付行業(yè)深度調(diào)查及投資運作模式分析報告
- 2024-2030年中國網(wǎng)絡(luò)定制巴士行業(yè)營銷模式及投資前景預(yù)測報告
- 2024-2030年中國筋骨傷噴霧劑產(chǎn)業(yè)未來發(fā)展趨勢及投資策略分析報告
- 2024-2030年中國立體停車場行業(yè)發(fā)展模式及十三五規(guī)劃分析報告(版)
- 2024-2030年中國礦用隔爆變壓器行業(yè)發(fā)展形勢及投資潛力研究報告
- 2024年入團知識考試題庫及答案
- 腫瘤化療導(dǎo)致的中性粒細(xì)胞減少診治中國專家共識(2023版)解讀
- 《新能源汽車概論》課件-6新能源汽車空調(diào)系統(tǒng)結(jié)構(gòu)及工作原理
- 2024年共青團入團考試題庫(附答案)
- 田徑運動會各種記錄表格
- 產(chǎn)科新生兒疫苗接種課件
- 企業(yè)信息管理概述課件
- 室外健身器材投標(biāo)方案(技術(shù)方案)
- 足浴店店長聘用合同范本
- tubeless胸科手術(shù)麻醉
- 電商免責(zé)聲明范本
評論
0/150
提交評論