




免費(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025二手車銷售合同范本
- 公共藝術(shù)設(shè)計(jì)
- 小班活動(dòng)安全教育
- 2025合同簽署注意事項(xiàng)
- 2025年網(wǎng)站會(huì)員商務(wù)信息服務(wù)合同范本
- 2025燈光音響租賃合同范本
- 2025年金融危機(jī)背景下:合同法執(zhí)行所面臨的挑戰(zhàn)及應(yīng)對(duì)策略
- 2025餐飲服務(wù)合同范本
- 2024-2025蘇教版科學(xué)一年級(jí)下冊(cè)第三單元測(cè)試卷及答案
- 2025小學(xué)道德與法治教師課標(biāo)考試模擬試卷及答案
- 專利代理師考試題庫(kù)含答案2024
- DB12 T1230-2023 政務(wù)信息資源共享 總體框架
- 管道拆除專項(xiàng)施工方案
- 廣西壯族自治區(qū)馬山縣實(shí)驗(yàn)高中-雙休背后:從“要我學(xué)”到“我要學(xué)”的轉(zhuǎn)變-高三家長(zhǎng)會(huì)【課件】
- GB/Z 27021.13-2025合格評(píng)定管理體系審核認(rèn)證機(jī)構(gòu)要求第13部分:合規(guī)管理體系審核與認(rèn)證能力要求
- 湖南省長(zhǎng)沙市四大名校2024-2025學(xué)年高三2月月考語(yǔ)文試題(原卷版+解析版)
- 《政府采購(gòu)管理研究的國(guó)內(nèi)外文獻(xiàn)綜述》5500字
- 糖尿病護(hù)理查房提出問(wèn)題
- 2024年國(guó)網(wǎng)浙江省電力有限公司招聘考試真題
- 微專題2 質(zhì)量守恒定律的應(yīng)用(解析版)
- 分析化學(xué)考試題(附參考答案)
評(píng)論
0/150
提交評(píng)論