【文章內(nèi)容簡(jiǎn)介】
t std_logic_vector(1 downto 0)。 電梯門(mén)控制信號(hào) led:out std_logic_vector(6 downto 0)。 電梯所在樓層顯示 led_c_u:out std_logic_vector(5 downto 0)。 電梯外的人上升請(qǐng)求信號(hào)顯示 led_c_d:out std_logic_vector(5 downto 0)。 電梯外的人下降請(qǐng)求信號(hào)顯示 led_d:out std_logic_vector(5 downto 0)。 電梯內(nèi)請(qǐng)求信號(hào)顯示 wahaha:out std_logic。 看門(mén)狗報(bào)警系統(tǒng) ud,alarm:out std_logic。 電梯運(yùn)動(dòng)方向顯示,超載報(bào)警信號(hào) up,down:out std_logic)。 電梯控制信號(hào)和電梯運(yùn)動(dòng) end dianti。 architecture behav of dianti is signal d11,d22,d33,d44,d55,d66:std_logic。 電梯內(nèi)請(qǐng)求信號(hào)寄存信號(hào) signal c_u11,c_u22,c_u33,c_u44,c_u55:std_logic。電梯外上升請(qǐng)求寄存信號(hào) signal c_d22,c_d33,c_d44,c_d55,c_d66:std_logic。電梯外下降請(qǐng)求寄存信號(hào) signal q:integer range 0 to 1。 分頻信號(hào) signal q1:integer range 0 to 6。 關(guān)門(mén)延時(shí)計(jì)數(shù)器 signal q2:integer range 0 to 9。 動(dòng)方向寄存器 signal dd,cc_u,cc_d,dd_cc:std_logic_vector(5 downto 0)。 signal opendoor:std_logic。 signal updown:std_logic。 signal en_up,en_dw:std_logic。 預(yù)備上 升,下降使能信號(hào) begin :process(clk) begin if clk39。event and clk=39。139。 then if clr=39。139。 then q1=0。q2=0。wahaha=39。039。 清除報(bào)警 elsif full=39。139。 then alarm=39。139。q1=0。 超載報(bào)警 if q1=3 then door=10。 else door=00。 end if。 elsif q=1 then q=0。alarm=39。039。 if q2=3 then wahaha=39。139。 故障報(bào)警 else if opendoor=39。139。 then door=10。q1=0。q2=0。up=39。039。down=39。039。 開(kāi)門(mén)操作 elsif en_up=39。139。 then 上升預(yù)操作 if deng=39。139。 then door=10。q1=0。q2=q2+1。 關(guān)門(mén)中斷 elsif quick=39。139。 then q1=3。 提前關(guān)門(mén) elsif q1=6 then door=00。updown=39。139。up=39。139。電梯進(jìn)入上升狀態(tài) elsif q1=3 then door=01。q1=q1+1。 電梯進(jìn)入關(guān)門(mén)狀態(tài) else q1=q1+1。door=00。 電梯進(jìn)入等待狀態(tài) end if。 elsif en_dw=39。139。 then 下降預(yù)操作 if deng=39。139。 then door=10。q1=0。q2=q2+1。 elsif quick=39。139。 then q1=3。 elsif q1=6 then door=00。updown=39。039。down=39。139。 elsif q1=3 then door=01。q1=q1+1。 else q1=q1+1。door=00。 end if。 end if。 if g1=39。139。 then led=1001111。 電梯到達(dá)一樓,顯示一樓 if d11=39。139。 or c_u11=39。139。 then d11=39。039。c_u11=39。039。opendoor=39。139。 當(dāng)前層請(qǐng)求,電梯進(jìn)入開(kāi)門(mén)狀態(tài) elsif dd_cc000001 then en_up=39。139。opendoor=39。039。有上升請(qǐng)求,電梯進(jìn)入預(yù)備上升狀態(tài) elsif dd_cc=000000 then opendoor=39。039。 無(wú)請(qǐng)求,一樓待機(jī) end if。 elsif g2=39。139。 then led=0010010。 電梯到達(dá)二樓,顯示 2 樓 if updown=39。139。 then 電梯前一狀態(tài)上升 if d22=39。139。 or c_u22=39。139。then d22=39。039。c_u22=39。039。opendoor=39。139。 當(dāng)前層有請(qǐng)求,開(kāi)門(mén)狀態(tài) elsif dd_cc000011 then en_u