⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keypro.vhd

📁 六层电梯控制vhdl六层电梯控制vhdl六层电梯控制vhdl六层电梯控制vhdl六层电梯控制vhdl
💻 VHD
字号:

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity keypro is
port (	clk:	in std_logic;		--按键时钟
	reset:		in std_logic;		--异步置位按键
	fup:		in std_logic_vector(5 downto 1);		--1层上升请求按键			
	fdn:		in std_logic_vector(6 downto 2);		--2层下降请求按键			
	fuplight:	out std_logic_vector (6 downto 1);--电梯外部上升请求指示灯
	fdnlight:	out std_logic_vector (6 downto 1);--电梯外部下降请求指示灯
	st: in std_logic_vector (6 downto 1);			--电梯内部各层请求按键
	stlight:	out std_logic_vector (6 downto 1);--电梯内部各层请求指示灯
	position:	in integer range 1 to 6	;	--电梯位置指示
	clearup:in std_logic;--用于清除上升请求指示灯的信号
  	cleardn:in std_logic--用于清除下降请求指示灯的信号
);
end keypro;
	

architecture behave of keypro is--控制按键信号灯进程

begin

process(reset,clk)
begin

  if reset = '0' then
	stlight <= "000000";
	fuplight <= "000000";
	fdnlight <= "000000";
  else 
	if clk'event and clk='1' then
		if clearup = '1' then
			stlight(position) <= '0';			
			fuplight(position) <= '0';		
		else
			fuplight <=(not fup) & '0';			
			stlight <= not st;	
		end if;
		
		if cleardn = '1' then
			stlight(position) <= '0';			
			fdnlight(position) <= '0';		
		else
			fdnlight <= '0' & (not fdn);			
			
			stlight <= not st;			
		end if;			
   end if;	
end if;
end process;

end behave;					
						
						
						
						
												

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -