




免費(fèi)預(yù)覽已結(jié)束,剩余1頁可下載查看
下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity elevator is -電梯外方向 PORT(clk1,clk2,start,reset,up1,up2,up3,down2,down3,down4,stop1,stop2,stop3,stop4: in std_logic; stoplight: buffer std_logic_vector(4 downto 1); uplight: buffer std_logic_vector(3 downto 1); downlight: buffer std_logic_vector(4 downto 2); position:buffer integer range 1 to 4; -電梯所在樓層 udsig:buffer std_logic; -指示方向 tdisplay:out std_logic_vector(4 downto 1); -12秒倒計(jì)時(shí) setlight:out std_logic_vector(3 downto 1) -樓層設(shè)置 );end elevator;architecture lift of elevator istype state_type is(stopat1,dclose,wait1,wait2,wait3,wait4,wait5,wait6,wait7,wait8, swup2,swup3,swup4,swup5, swdn2,swdn3,swdn4,swdn5, up,down,stop,stopq);signal state:state_type;signal clearup,cleardown:std_logic;begin zt:process(clk2,reset)variable pos: std_logic_vector(1 downto 0);beginif reset=1 then state=stopat1;position=1;pos:=00;clearup=0;cleardownstate=wait1;udsigstate=wait2;tdisplay=1000; if start=1 then state=dclose;elsif uplight(position)=1 or downlight(position)=1 then state=wait1;clearup=1;cleardownstate=wait3;tdisplay=0111;clearup=0;cleardown=0; if start=1 then state=dclose;elsif uplight(position)=1 or downlight(position)=1 then state=wait1;clearup=1;cleardownstate=wait4;tdisplay=0110; if start=1 then state=dclose;elsif uplight(position)=1 or downlight(position)=1 then state=wait1;clearup=1;cleardownstate=wait5;tdisplay=0101; if start=1 then state=dclose;elsif uplight(position)=1 or downlight(position)=1 then state=wait1;clearup=1;cleardownstate=wait6;tdisplay=0100; if start=1 then state=dclose;elsif uplight(position)=1 or downlight(position)=1 then state=wait1;clearup=1;cleardownstate=wait7;tdisplay=0011; if start=1 then state=dclose;elsif uplight(position)=1 or downlight(position)=1 then state=wait1;clearup=1;cleardownstate=wait8;tdisplay=0010; if start=1 then state=dclose;elsif uplight(position)=1 or downlight(position)=1 then state=wait1;clearup=1;cleardownstate=dclose;tdisplayif udsig=0 then -上升情況if position=4 then -電梯在四樓if stoplight=0000and uplight=000and downlight=000 thenudsig=1;state=dclose;elsif downlight(4)=1thenstate=stopq;else udsig=1;state=down;end if;elsif position=3 then -電梯在三樓if stoplight=0000and uplight=000and downlight=000 thenudsig=0;state=dclose;elsif stoplight(4)=1 or downlight(4)=1 thenudsig=0;state=up;elsif uplight(3)=1thenstate=stop;elsif downlight(3)=1thenstate=stopq;elseudsig=1;state=down;end if;elsif position=2 then -電梯在二樓if stoplight=0000and uplight=000and downlight=000 thenudsig=0;state=dclose;elsif stoplight(3)=1or uplight(3)=1or stoplight(4)=1or downlight(4)=1 thenudsig=0;state=up;elsif uplight(2)=1thenstate=stop;elsif downlight(2)=1thenstate=stopq; elseudsig=1;state=down;end if;elsif position=1 then -電梯在一樓if stoplight=0000and uplight=000and downlight=000 thenudsig=0;state=dclose;elsif uplight(1)=1thenstate=stop;elseudsig=0;state=up;end if;end if;elsif udsig=1 then -下降情況if position=1 then -電梯在一樓if stoplight=0000and uplight=000and downlight=000 thenudsig=0;state=dclose;elsif uplight(1)=1thenstate=stop;elseudsig=0;state=up;end if;elsif position=2 then -電梯在二樓if stoplight=0000and uplight=000and downlight=000 thenudsig=1;state=dclose;elsif stoplight(1)=1or uplight(1)=1 thenudsig=1;state=down;elsif uplight(2)=1thenstate=stop;elsif downlight(2)=1thenstate=stopq;else udsig=0;state=up;end if;elsif position=3 then -電梯在三樓if stoplight=0000and uplight=000and downlight=000 thenudsig=1;state=dclose;elsif stoplight(2)=1or downlight(2)=1or stoplight(1)=1or uplight(1)=1 thenudsig=1;state=down;elsif uplight(3)=1thenstate=stop;elsif downlight(3)=1thenstate=stopq;elseudsig=0;state=up;end if;elsif position=4 then -電梯在四樓if stoplight=0000and uplight=000and downlight=000 thenudsig=1;state=dclose;elsif downlight(4)=1thenstate=stopq;elseudsig=1;statestate=swup5;tdisplaystate=swup4;tdisplaystate=swup3;tdisplaystate=swup2;tdisplaytdisplay=0001;-顯示1if pos=00 then position=2;pos:=01;-顯示第2層elsif pos=01 then position=3;pos:=10;-顯示第3層elsif pos=10 then position=4;pos:=11;-顯示第4層end if; if pos=01 and stoplight(2)=0and uplight(2)=0and(stoplight(3)=1or uplight(3)=1or stoplight(4)=1or downlight(4)=1)thenstate=up;elsif pos=10 and stoplight(3)=0and uplight(3)=0and(stoplight(4)=1or downlight(4)=1) thenstate=up;elsif pos=11 thenstate=stopq;elsestatestate=swdn5;tdisplaystate=swdn4;tdisplaystate=swdn3;tdisplaystate=swdn2;tdisplaytdisplay=0001;-顯示1if pos=01 then position=1;pos:=00;-顯示第1層elsif pos=10 then position=2;pos:=01;-顯示第2層elsif pos=11 then position=3;pos:=10;-顯示第3層end if; if pos=10 and stoplight(3)=0 and downlight(3)=0and(stoplight(2)=1or downlight(2)=1or stoplight(1)=1or uplight(1)=1) thenstate=down;elsif pos=01 and stoplight(2)=0 and downlight(2)=0and(stoplight(1)=1or uplight(1)=1) thenstate=down;elsif pos=00thenstate=stop;elsestateclearup=1;statecleardown=1;statestate=stopat1;end case;end if;end process zt;sr:process(clk1)beginif reset=1 thenstoplight=0000;uplight=000;downlight=000;setlight=000;elsif ( clk1=1 and clk1EVENT) then if clearup=1 thenstoplight(position)=0;uplight(position)=0;elseif up1=1then uplight(1)=1;setlight=001;end if;if up2=1then uplight(2)=1;setlight=010;end if;if up3=1then uplight(3)=1;setlight=011;end if;end if;if cleardown=1 thenstoplight(position)=0;downlight(position)=0;elseif down2=1then downlight(2)=1;setlight=010;end if;if down3=1then downlight(3)=1;setlight=011;end if;if down4=
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 設(shè)計(jì)思維在紡織中的試題及答案
- 云南合同協(xié)議書
- 農(nóng)村公路養(yǎng)護(hù)合同協(xié)議書
- 協(xié)議書 合同 區(qū)別
- 購機(jī)合同協(xié)議書
- 更名合同協(xié)議書
- 保姆雇傭住家合同協(xié)議書
- 規(guī)范合同協(xié)議書
- 授課合同協(xié)議書
- 建筑合同協(xié)議書
- 【MOOC】中醫(yī)與診斷-學(xué)做自己的醫(yī)生-暨南大學(xué) 中國大學(xué)慕課MOOC答案
- 2024年高考真題-生物(天津卷) 含解析
- 浸水電梯應(yīng)急保障檢測(cè)規(guī)范DB1305T+95-2024
- 醫(yī)療安全(不良)事件報(bào)告制度培訓(xùn)課件
- 自動(dòng)噴水滅火系統(tǒng)施工安裝質(zhì)量記錄(樣本)
- 12SS508混凝土模塊式室外給水管道附屬構(gòu)筑物
- T-LNEMA 013-2024 實(shí)驗(yàn)室危險(xiǎn)化學(xué)品貯存管理技術(shù)規(guī)范
- 麻辣燙合伙人合同協(xié)議書(2篇)
- 青年人要有艱苦奮斗的精神(2023年遼寧沈陽中考語文試卷議論文閱讀題及答案)
- 食品安全前提方案PRP程序
- 構(gòu)建水利安全生產(chǎn)風(fēng)險(xiǎn)管控六項(xiàng)機(jī)制工作指導(dǎo)手冊(cè)
評(píng)論
0/150
提交評(píng)論