library ieee;
use ieee.std_logic_1164.all;
entity seg7 is
port(Din :in std_logic_vector(3 downto 0);
a,b,c,d,e,f,g,s7:out std_logic);
end seg7;
architecture a of seg7 is
begin
process(Din)
begin
s7<='1';
case Din is
when "0000" =>a<='0';b<='0';c<='0';d<='0';e<='0';f<='0';g<='1';
when "0001" =>a<='1';b<='0';c<='0';d<='1';e<='1';f<='1';g<='1';
when "0010" =>a<='0';b<='0';c<='1';d<='0';e<='0';f<='1';g<='0';
when "0011" =>a<='0';b<='0';c<='0';d<='0';e<='1';f<='1';g<='0';
when "0100" =>a<='1';b<='0';c<='0';d<='1';e<='1';f<='0';g<='0';
when "0101" =>a<='0';b<='1';c<='0';d<='0';e<='1';f<='0';g<='0';
when "0110" =>a<='0';b<='1';c<='0';d<='0';e<='0';f<='0';g<='0';
when "0111" =>a<='0';b<='0';c<='0';d<='1';e<='1';f<='1';g<='1';
when "1000" =>a<='0';b<='0';c<='0';d<='0';e<='0';f<='0';g<='0';
when "1001" =>a<='0';b<='0';c<='0';d<='0';e<='1';f<='0';g<='0';
when others =>a<='1';b<='1';c<='1';d<='1';e<='1';f<='1';g<='1';
end case;
end process;
end a;
- Mar 10 Tue 2009 14:41
2008-06-06--七段顯示器

Recommend to Front page

Comment Permissions: Allow commenting