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

📄 shiwei.vhd

📁 停车场显示是日常生活中使用很平常的系统
💻 VHD
字号:
--数码管显示停车位个数的十位
 
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

entity shiwei is
	port(
		clk  : in std_logic;
		chewei : in std_logic_vector(6 downto 0);
		ledshi: out std_logic_vector(6 downto 0)
		);
end shiwei;

architecture shiwei of shiwei is

begin

	process(clk)
	variable carnm : integer range 0 to 64;
	variable s: integer range 0 to 9;
	begin
	        carnm:=conv_integer(chewei);        
			 
			    s:=carnm/10;  --十位数                     
			  
			case s is                   --七段译码
				when 0=>ledshi<="1111110";
				when 1=>ledshi<="0110000";
				when 2=>ledshi<="1101101";
				when 3=>ledshi<="1111001";
				when 4=>ledshi<="0110011";
				when 5=>ledshi<="1011011";
				when 6=>ledshi<="1011111";
				when 7=>ledshi<="1110000";
				when 8=>ledshi<="1111111";
				when 9=>ledshi<="1111011";
				when others=>ledshi<="0000000";
			end case;
	end process;
end shiwei;

⌨️ 快捷键说明

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