EDA电梯控制器课程设计报告 联系客服

发布时间 : 星期四 文章EDA电梯控制器课程设计报告更新完毕开始阅读d5e64dc8cbaedd3383c4bb4cf7ec4afe05a1b15a

沈阳理工大学课程设计专用纸

signal disp:std_logic_vector(3 downto 0); begin

process(clk) begin

if rising_edge(clk)then upkey_data<=upkey; downkey_data<=downkey;

opendoor2<=opendoor1; opendoor1<=opendoor; end if;

end process;

req_opendoor<=(opendoor1 and not(opendoor2)); process(switch,clk) begin if(switch='0')then req_upr<='0'; req_downr<='0';

elsif(rising_edge(clk))then if(req_opendoor='1' and qin=id)then req_upr<='0'; req_downr<='0';

elsif(upkey='1' and upkey_data='0')then req_upr<='1';

elsif(downkey='1' and downkey_data='0')then req_downr<='1'; end if; end if; end process;

ur<=req_upr; dr<=req_downr;

5

沈阳理工大学课程设计专用纸

with qin select

disp<=\ \ \ \ \ \ \ \ \ \ \disp1<=disp; end art;

3.2顶层模块设计

10层全自动电梯控制器顶层模块源程序如下:

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity elevator10 is

port(clk:in std_logic; --时钟信号

switch:in std_logic; --电梯电源开关,高电平时电梯正常工作 close:in std_logic; --强制关门信号,高电平时电梯门立即关闭

delay:in std_logic; --延时信号 sel:in std_logic_vector(10 downto 1); --楼层选择信号

uplift:in std_logic_vector(10 downto 1); --电梯上升请求输入信号 downlift:in std_logic_vector(10 downto 1); --电梯下降请求输入信号 qout:out std_logic_vector(10 downto 1); --电梯状态显示输出信号 opendoor:out std_logic); --强制开门信号 end;

architecture art of elevator10 is

6

沈阳理工大学课程设计专用纸

component counter

port(clk,reset,clr,en:in std_logic; q:out integer range 0 to 8);

end component;

type state_type is(up,m_up,down,m_down,stop,pause);

signal state:state_type; --电梯的各种状态 signal clk1:std_logic; --1Hz时钟信号 signal clk4:std_logic; --4Hz时钟信号 signal req_up:std_logic; --上升请求信号 signal req_down:std_logic; --下降请求信号 signal runen:std_logic; --电梯运行使能 signal runclr:std_logic; --电梯运行复位 signal stopen0:std_logic; --电梯停止使能 signal stopen1:std_logic;

signal stopclr:std_logic; --电梯停止复位 signal req_upr:std_logic_vector(10 downto 1); ---上升请求寄存器信号 signal req_downr:std_logic_vector(10 downto 1); --下降请求寄存器信号 signal position:std_logic_vector(10 downto 1); --电梯当前位置信号 signal uplift_data:std_logic_vector(10 downto 1); --上升楼层数据显示信号 signal downlift_data:std_logic_vector(10 downto 1); --下降楼层数据显示信号 signal sel_data:std_logic_vector(10 downto 1); --选择楼层数据显示信号 signal runtime: integer range 0 to 8; --电梯运行时间 signal opentime:integer range 0 to 8; --电梯开门时间 signal openagain:std_logic; --电梯再次开门信号 signal voidreset:std_logic; --电梯超载复位信号 begin

qout<=position;

p0:process(clk)

variable cnt0:integer range 0 to 4; begin

7

沈阳理工大学课程设计专用纸

if rising_edge(clk)then if cnt0=4 then

clk4<='1';cnt0:=0;

else

clk4<='0';cnt0:=cnt0+1;

end if; end if;

end process; p1:process(clk4)

variable cnt1:integer range 0 to 3; begin

if rising_edge(clk4)then if cnt1=3 then

clk1<='1';cnt1:=0;

else

clk1<='0';cnt1:=cnt1+1;

end if; end if;

end process;

p2:process(switch,clk,uplift,downlift) begin

if rising_edge(clk)then uplift_data<=uplift; downlift_data<=downlift; sel_data<=sel; if state=pause then

req_upr<=req_upr and not(position); req_downr<=req_downr and not(position);

if(uplift/=uplift_data and req_up/='1' and position>uplift)then req_downr<=(req_downr or uplift);

8