




免費(fèi)預(yù)覽已結(jié)束,剩余1頁(yè)可下載查看
下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 銷(xiāo)售稅務(wù)常識(shí)培訓(xùn)課件
- 健康飲食產(chǎn)業(yè)園項(xiàng)目質(zhì)量管理方案(參考)
- 2025年雙門(mén)轎跑車(chē)合作協(xié)議書(shū)
- 2025年汽車(chē)尾氣自動(dòng)測(cè)定儀合作協(xié)議書(shū)
- 鄉(xiāng)城流動(dòng)中的中國(guó)男性婚姻擠壓緒論
- 2025年臨床前CRO項(xiàng)目發(fā)展計(jì)劃
- 物業(yè)服務(wù)委托合同 (二)
- 2025年無(wú)機(jī)電子材料合作協(xié)議書(shū)
- 2025年黑龍江省中考生物試卷(含答案)
- 2025年閑置物品調(diào)劑回收項(xiàng)目合作計(jì)劃書(shū)
- 國(guó)有企業(yè)技能人才的職業(yè)發(fā)展路徑與激勵(lì)機(jī)制研究
- 反應(yīng)釜(容器)生產(chǎn)企業(yè)安全風(fēng)險(xiǎn)分級(jí)管控資料
- 營(yíng)養(yǎng)專(zhuān)科護(hù)士工作總結(jié)
- 2025年上海市松江西部自來(lái)水有限公司招聘筆試參考題庫(kù)含答案解析
- 2025年醫(yī)療救護(hù)員、護(hù)理員職業(yè)技能鑒定理論考試指導(dǎo)題庫(kù)-上(單選、多選、判斷題)
- 2025年度醫(yī)院檢驗(yàn)科人員培訓(xùn)計(jì)劃
- 2025年重慶高職分類(lèi)考試(教育類(lèi))備考試題庫(kù)(含答案)
- 2025年多媒體技術(shù)應(yīng)用:數(shù)字化博物館的構(gòu)建
- 老年人心理健康課件
- 充電樁安裝勞務(wù)合同范例
- 2024年江蘇省支付清算知識(shí)競(jìng)賽備考試題庫(kù)(含答案)
評(píng)論
0/150
提交評(píng)論