版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、1、每層電梯的入口處設(shè)有上下請(qǐng)求開(kāi)關(guān),電梯內(nèi)設(shè)有乘客到達(dá)層次的停站請(qǐng)求開(kāi)關(guān)。2、設(shè)有電梯所處位置指示裝置及電梯運(yùn)行模式(上升或下降)指示裝置。3、電梯每秒升降一層。4、 電梯到達(dá)有停站請(qǐng)求的樓層后,經(jīng)過(guò)1s電梯打開(kāi),開(kāi)門只是燈亮,開(kāi)門4s后,電梯門關(guān)閉(關(guān)門指示燈滅),電梯繼續(xù)運(yùn)行,直至執(zhí)行完請(qǐng)求信號(hào)后停在當(dāng)前樓層。5、能記憶電梯內(nèi)外的所以請(qǐng)求信號(hào),并按照電梯運(yùn)行規(guī)則依次響應(yīng),每個(gè)請(qǐng)求信號(hào)保留至執(zhí)行后消除。6、電梯運(yùn)行規(guī)則:當(dāng)電梯處于上升模式時(shí),只響應(yīng)比電梯所在位置高的上樓信號(hào),由下至上依次執(zhí)行, 直到最后一個(gè)上樓請(qǐng)求執(zhí)行完畢,如更高層有下樓請(qǐng)求時(shí),則直接升到有下降請(qǐng)求的最高樓接客,然后進(jìn) 入
2、下降模式,但電梯處于下降模式時(shí),則與上升模式相反。7、電梯初始狀態(tài)為一層門開(kāi)。library ieee;useuseentity ledl isport(ledin:instd_logic_vector(3downto 0);ledout:outstd_logic_vector(6downto 0);end led1;architecturea led of led1 isbeginprocess(ledin)begincaseledin is-The sequence is "g f e d c b a"when"0000"=>ledout<
3、;="0111111"IIshow0 "when"0001"=>ledout<="0000110"IIshow1 "when"0010"=>ledout<="1011011"IIshow2 "when"0011"=>ledout<="1001111"IIshow3 "when"0100"=>ledout<="1100110"IIs
4、how4 "when"0101"=>ledout<="1101101"-"show5 "when"0110"=>ledout<="1111101"'1.1show6 "when"0111"=>ledout<="0000111"IIshow7 "when"1000"=>ledout<="1111111"IIshow8 "wh
5、en"1001"=>ledout<="1101111"IIshow9 "when"1010"=>ledout<="1110111"IIshow10 "when"1011"=>ledout<="1111100"-"show11 "when"1100"=>ledout<="0111001"-"show12 "when"110
6、1"=>ledout<="1011110"-"show13 "when"1110"=>ledout<="1111001"-"show14 "when"1111"=>ledout<="1110001"-"show15 "whenothers=>ledout<="XXXXXXX"-必須有,Here it is 'X',single quoteend
7、 case;end process ;end a_led;library IEEE;useuseuseentity liftl isport (clk: in STD_LOGIC; -2hz 信號(hào)upin: in STD_LOGIC;-上升請(qǐng)求鍵downin: in STD_LOGIC;-下降請(qǐng)求鍵st_ch: in STD_LOGIC;-樓層選擇鍵close: in STD_LOGIC;-提前關(guān)門鍵delay: in STD_LOGIC;-延時(shí)關(guān)門鍵run_stop: in STD_LOGIC;-電梯運(yùn)行開(kāi)關(guān)lamp: out STD_LOGIC;-運(yùn)行或停止燈run_waitdis: ou
8、t STD_LOGIC_VECTOR (6 downto 0);-運(yùn)行或等待時(shí)間 st_outdis: out STD_LOGIC_VECTOR (6 downto 0);-電梯所在樓層指示 directdis: out STD_LOGIC_VECTOR (6 downto 0)-樓層選擇指示);end lift1;architecture lift1_arch of lift1 iscomponent led1port(ledin:in std_logic_vector(3 downto 0);ledout:out std_logic_vector(6 downto 0);end compo
9、nent;signal ur,dr:STD_LOGIC_VECTOR (6 downto 1);signal dir,liftor:integer range 0 to 5;signal wai_t:STD_LOGIC_VECTOR (2 downto 0);signal divide,hand,clkin:STD_LOGIC;signal ladd:STD_LOGIC_VECTOR (1 downto 0);signal closex,delayx:STD_LOGIC;signal run_wait: STD_LOGIC_VECTOR (3 downto、0);signal st_out:
10、STD_LOGIC_VECTOR (3 downto 0); signal direct: STD_LOGIC_VECTOR (3 downto 0);begindirect<='0'&conv_std_logic_vector(dir,3)+1; st_out<='0'&conv_std_logic_vector(liftor,3)+1;run_wait<='0'&wai_t;lampv=ladd(1);hand<=wai_t(2) and (not wai_t(1) and wai_t(0);
11、closex<=close and (not ladd(1);delayx<=delayand (not ladd(1);urun_wait:led1port map(run_wait,run_waitdis);ust_out:led1 port map(st_out,st_outdis);udirect:led1 port map(direct,directdis);p0:process(clk)beginif (clk'event and clk='1') thenclkin<=not clkin;end if;end process p0;p1:
12、process(clkin)beginif (clkin'event and clkin='1') then divide<=not divide;thendir<=0;elsedir<=dir+1;end if;end if;end process p1;p2:process(ur,dr,dir,upin,downin,st_ch,liftor,wai_t,run_stop,hand) variable num,t:integer range 0 to 6;beginnum:=lift o葉1;t:=di r+1;if (run_stop='
13、1') thenif (t>num) and (st_ch='1') or (upin='1') thencase t iswhen 1 => ur(1)<='1'when2=>ur(2)<='1'when3=>ur(3)<='1'when4=>ur(4)<='1'when5=>ur(5)<='1'when6=>ur(6)<='1'whenothers=>Null;end ca
14、se;elsif (hand='1) thencase num iswhen1=>ur(1)<='0'when2=>ur(2)<='0'when3=>ur(3)<='0'when4=>ur(4)<='0'when5=>ur(5)<='0'when6=>ur(6)<='0'whenothers=>Null;end case;thenend if;if (tvnum) and (st_ch='1') o
15、r (downin='1') case t iswhen1=>dr(1)<='1'when2=>dr(2)<='1'when3=>dr(3)<='1'when4=>dr(4)<='1'when5=>dr(5)<='1'when6=>dr(6)<='1'whenothers=>Null;end case;elsif (hand='1) thencase num iswhen1=>dr(1)<
16、;='O'when2=>dr(2)<='0'when3=>dr(3)<='0'when4=>dr(4)<='0'when5=>dr(5)<='0'when6=>dr(6)<='0'whenothers=>Null;end case;end if;elseur<="000000"dr<="OOOOOO"end if;end process p2;p3:process(ur,dr,lif
17、tor,ladd,wai_t,run_stop)beginif (run_stop='1) thenif (wai_t="110") thenif (ur or dr)="OOOOOO")ladd(1)<='0'elsethencase liftor iswhen 0 =>if (ur(1) ordr(1)>'0') thenladd(1)<='0'else ladd<="11"end if;when 1 =>if (ur(2) ordr(2)
18、>'0') thenladd(1)<='0'elsif(ladd(0)='1') and (ur(6 downto 3)ordr(6downto3)>"0000")or(ur(1) or dr(1)='O') theladd<="11"else ladd<="10"end if;ladd(1)<='0'ownto 1)="00") thenwhen 2 =>if (ur(3) or dr(3)&
19、gt;'0') thenelsif(ladd(0)='1') and (ur(6 downto 4)ordr(6downto4)>"000")or(ur(2 downto 1) or dr(2 dladd<="11"else ladd<="10"end if;when 3 =>if (ur(4) or dr(4)>'0') thenladd(1)<='0'elsif(ladd(0)='1') and (ur(6 down
20、to 5)ordr(6downto5)>"00")or(ur(3 downto 1) or dr(3 downto 1)="000") thenladd<="11"elseladd<="10"end if;when 4 =>if (ur(5) or dr(5)>'0') thenladd(1)<='0'elsif(ladd(0)='1') and (ur(6) or dr(6)>'0')or(ur(4 down
21、to 1) ordr(4 downto 1)="0000") theladd<="11"elseladd<="10"end if;when 5 =>if (ur(6) or dr(6)>'0') then ladd(1)<='0'elseladd<="10"end if;when others=>null;end case;end if;end if;elseladd<="00"end if;end process
22、p3;p4:process(divide,wai_t,ladd,closex,delayx)beginif (divide'event and divide='1') thenif (wai_t="000"or closex='1') thenwai_t<="110"elseif (delayx='0) thenwai_t<=wai_t-1;elsewai_t<="010"if (wai_t="001") then if (ladd="11
23、") then liftor<=liftor+1;elsif (ladd="10") then liftor<=liftor-1;end if;end if;end if;end if;end process p4;end lift1_arch;library IEEE;useuseuseentity lifter isport (elk: in STD_LOGIC; -4mhz 信號(hào) upin: in STD_LOGIC;-上升請(qǐng)求鍵 downin: in STD_LOGIC;-下降請(qǐng)求鍵 st_ch: in STD_LOGIC;-樓層選擇鍵 clo
24、se: in STD_LOGIC;-提前關(guān)門鍵 delay: in STD_LOGIC;-延時(shí)關(guān)門鍵 run_stop: in STD_LOGIC;-電梯運(yùn)行開(kāi)關(guān) lamp: out STD_LOGIC;-運(yùn)行或停止燈 selout:out STD_LOGIC_VECTOR (2 downto 0); segout: out STD_LOGIC_VECTOR (6 downto 0) );end lifter;architecture lift1_arch of lifter iscomponent led1port(ledin:in std_logic_vector(3 downto 0);
25、 ledout:out std_logic_vector(6 downto 0);end component;signal ur,dr:STD_LOGIC_VECTOR (6 downto 1); signal dir,liftor:integer range 0 to 5;signal wai_t:STD_LOGIC_VECTOR (2 downto 0); signal div,cp,hand,clkin:STD_LOGIC;signal ladd,s:STD_LOGIC_VECTOR (1 downto 0); signal closex,delayx:STD_LOGIC;signal
26、run_wait: STD_LOGIC_VECTOR (3 downto 0); signal st_out: STD_LOGIC_VECTOR (3 downto 0); signal direct: STD_LOGIC_VECTOR (3 downto 0); signal dout: STD_LOGIC_VECTOR (3 downto 0); signal q:STD_LOGIC_VECTOR (21 downto 0);begindirect<='0'&conv_std_logic_vector(dir,3)+1; st_out<='0
27、39;&conv_std_logic_vector(liftor,3)+1; run_wait<='0'&wai_t;lampv=ladd(1);hand<=wai_t(2)and (not wai_t(1) and wai_t(0);closex<=(notclose)and(notladd(1);delayx<=(notdelay)and(notladd(1);selout<="001"whens=0else"010" when s=1 else"100" when s
28、=2 else"000"dout<=direct when s=0 else run_wait when s=1 else st_out when s=2 else "0000000"u:led1 port map(dout,segout);p0:process(clk)beginif (clk'event and clk='1') then qv=q+1;end if;end process p0;cp<=q(20);s<=q(14 downto 13); p1:process(cp) beginif (cp&
29、#39;event and cp='1') then div<=not div;if (dir=5) thendir<=0;elsedir<=dir+1;end if;end if;end process p1;p2:process(ur,dr,dir,upin,downin,st_ch,liftor,wai_t,run_stop,hand) variable num,t:integer range 0 to 6;beginnum:=liftor+1;t:=di r+1;if (run_stop='1') then if (t>num)
30、and (st_ch='0') or (upin='0') then case t iswhen 1 => ur(1)<='1'when 2 => ur(2)<='1'when 3 =>ur(3)<='1'when 4 =>ur(4)<='1'when 5 =>ur(5)<='1'when 6 => ur(6)<='1'when others =>Null;end case;elsif (h
31、and='1') thencase num iswhen1=>ur(1)<='0'when2=>ur(2)<='0'when3=>ur(3)<='0'when4=>ur(4)<='0'when5=>ur(5)<='0'when6=>ur(6)<='0'whenothers=>Null;end case;thenend if;if (t<num) / and (st_ch='O') or
32、 (downin='0') case t iswhen1=>dr(1)<='1'when2=>dr(2)<='1'when3=>dr(3)<='1'when4=>dr(4)<='1'when5=>dr(5)<='1'when6=>dr(6)<='1'whenothers=>Null;end case;elsif (hand='1') thencase num is when 1 =>
33、dr(1)<='0'when 2 => dr(2)<='0'when 3 => dr(3)v='0'when 4 => dr(4)<='0'when 5 => dr(5)<='0'when 6 => dr(6)<='0'when others =>Null;end case;end if;elseur<="000000"dr<="000000"end if;end process p
34、2;p3:process(ur,dr,liftor,ladd,wai_t,run_stop)beginif (run_stop='1)thenif (wai_t="110")thenif (ur or dr)="000000") thenladd(1)<='0'elsecase liftor iswhen 0 =>if (ur(1) or dr(1)>'0') thenladd(1)<='0'elseladd<="11"end if;when 1 =
35、>if (ur(2) or dr(2)>'0') thenladd(1)<='0'elsif(ladd(0)='1') and (ur(6 downto 3)ordr(6downto3)>"0000")or(ur(1) or dr(1)='0') theladd(1)<='0'elsif(ladd(0)='1') and (ur(6 downto 4)ordr(6downto4)>"000")or(ur(2 downto 1) or dr(2 downto 1)="00") thenladd<="11"else ladd<="10"end if;when 2 =>if (ur(3) or dr(3)>'0') thenend if;ladd(1)<='0
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年電子競(jìng)技賽事收益分成協(xié)議3篇
- 二零二五版加密數(shù)據(jù)存儲(chǔ)與保管服務(wù)合同2篇
- 二零二五年度物聯(lián)網(wǎng)股東合作協(xié)議范本3篇
- 2025年度建筑拆除與垃圾清運(yùn)合同樣本4篇
- 臨沂市2024年機(jī)關(guān)單位勞動(dòng)合同
- 二年級(jí)數(shù)學(xué)計(jì)算題專項(xiàng)練習(xí)1000題匯編集錦
- 一年級(jí)數(shù)學(xué)計(jì)算題專項(xiàng)練習(xí)匯編
- 項(xiàng)目轉(zhuǎn)讓合同范本
- 2025年人教新起點(diǎn)九年級(jí)地理下冊(cè)月考試卷含答案
- 獨(dú)家廣告贊助合同書(shū)
- 英語(yǔ)名著閱讀老人與海教學(xué)課件(the-old-man-and-the-sea-)
- 學(xué)校食品安全知識(shí)培訓(xùn)課件
- 全國(guó)醫(yī)學(xué)博士英語(yǔ)統(tǒng)一考試詞匯表(10000詞全) - 打印版
- 最新《會(huì)計(jì)職業(yè)道德》課件
- DB64∕T 1776-2021 水土保持生態(tài)監(jiān)測(cè)站點(diǎn)建設(shè)與監(jiān)測(cè)技術(shù)規(guī)范
- ?中醫(yī)院醫(yī)院等級(jí)復(fù)評(píng)實(shí)施方案
- 數(shù)學(xué)-九宮數(shù)獨(dú)100題(附答案)
- 理正深基坑之鋼板樁受力計(jì)算
- 學(xué)校年級(jí)組管理經(jīng)驗(yàn)
- 10KV高壓環(huán)網(wǎng)柜(交接)試驗(yàn)
- 未來(lái)水電工程建設(shè)抽水蓄能電站BIM項(xiàng)目解決方案
評(píng)論
0/150
提交評(píng)論